From af8ec5e1b410ea1587e16d7260573783b88af2c3 Mon Sep 17 00:00:00 2001 From: Muhamed Emad Date: Sun, 7 Apr 2024 20:33:08 +0200 Subject: [PATCH] echo: enable Werror Part of #9460 * If there is an operation between signed and unsigned int, the unsigned is changed to signed one, except for some operations (if before the operation the signed one is checked to be less than zero or not, then the signed one get cast to be unsigned (errors due to sign error when casting are impossible)) * When doing operations on pointers, integers get cast to uintptr_t type Untested: I don't have the hardware. Change-Id: I6a959c004862e055ee99f6f2ad5ca3397b32cdd2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7484 Reviewed-by: waddlesplash Tested-by: Commit checker robot --- src/add-ons/kernel/drivers/audio/echo/multi.cpp | 6 +++--- src/add-ons/kernel/drivers/audio/echo/util.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/echo/multi.cpp b/src/add-ons/kernel/drivers/audio/echo/multi.cpp index 6b5dfcda1b..17dbb06658 100644 --- a/src/add-ons/kernel/drivers/audio/echo/multi.cpp +++ b/src/add-ons/kernel/drivers/audio/echo/multi.cpp @@ -255,7 +255,7 @@ echo_get_mix(echo_dev *card, multi_mix_value_info * mmvi) multi_mixer_control *control = NULL; for (i = 0; i < mmvi->item_count; i++) { id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; - if (id < 0 || id >= card->multi.control_count) { + if (id < 0 || (uint32)id >= card->multi.control_count) { PRINT(("echo_get_mix : invalid control id requested : %" B_PRIu32 "\n", id)); continue; @@ -297,7 +297,7 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi) multi_mixer_control *control = NULL; for (i = 0; i < mmvi->item_count; i++) { id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; - if (id < 0 || id >= card->multi.control_count) { + if (id < 0 || (uint32)id >= card->multi.control_count) { PRINT(("echo_set_mix : invalid control id requested : %" B_PRIu32 "\n", id)); continue; @@ -308,7 +308,7 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi) multi_mixer_control *control2 = NULL; if (i + 1 < mmvi->item_count) { id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID; - if (id < 0 || id >= card->multi.control_count) { + if (id < 0 || (uint32)id >= card->multi.control_count) { PRINT(("echo_set_mix : invalid control id requested : %" B_PRIu32 "\n", id)); } else { diff --git a/src/add-ons/kernel/drivers/audio/echo/util.c b/src/add-ons/kernel/drivers/audio/echo/util.c index b76abf46d7..d4b4648d64 100644 --- a/src/add-ons/kernel/drivers/audio/echo/util.c +++ b/src/add-ons/kernel/drivers/audio/echo/util.c @@ -114,7 +114,7 @@ map_mem(void **log, phys_addr_t phy, size_t size, const char *name) size = round_to_pagesize(size + offset); area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, &mapadr); - *log = mapadr + offset; + *log = (void *)((uintptr_t)mapadr + (uintptr_t)offset); LOG(("physical = %p, logical = %p, offset = %#x, phyadr = %p, mapadr = %p, size = %#x, area = %#x\n", phy, *log, offset, phyadr, mapadr, size, area));