From 155f42a9fa7d96b6731dc511a6346ea8bcef7efe Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 17 Aug 2022 10:21:28 +0200 Subject: [PATCH] task_wdt: Fix build warning on 64-bit platforms When building for 64-bit platform (tested on native_posix_64), there was a cast warning for different sizes. A void * is used to store a simple ID, fixed by using uintptr_t instead. Signed-off-by: Pieter De Gendt --- subsys/task_wdt/task_wdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/task_wdt/task_wdt.c b/subsys/task_wdt/task_wdt.c index c21c822068b..035a26017be 100644 --- a/subsys/task_wdt/task_wdt.c +++ b/subsys/task_wdt/task_wdt.c @@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(task_wdt); * This dummy channel is used to continue feeding the hardware watchdog if the * task watchdog timeouts are too long for regular updates */ -#define TASK_WDT_BACKGROUND_CHANNEL (-1) +#define TASK_WDT_BACKGROUND_CHANNEL UINTPTR_MAX /* * Task watchdog channel data @@ -52,8 +52,8 @@ static bool hw_wdt_started; static void schedule_next_timeout(int64_t current_ticks) { - int next_channel_id; /* channel which will time out next */ - int64_t next_timeout; /* timeout in absolute ticks of this channel */ + uintptr_t next_channel_id; /* channel which will time out next */ + int64_t next_timeout; /* timeout in absolute ticks of this channel */ #ifdef CONFIG_TASK_WDT_HW_FALLBACK next_channel_id = TASK_WDT_BACKGROUND_CHANNEL; @@ -100,7 +100,7 @@ static void schedule_next_timeout(int64_t current_ticks) */ static void task_wdt_trigger(struct k_timer *timer_id) { - int channel_id = (int)k_timer_user_data_get(timer_id); + uintptr_t channel_id = (uintptr_t)k_timer_user_data_get(timer_id); bool bg_channel = IS_ENABLED(CONFIG_TASK_WDT_HW_FALLBACK) && (channel_id == TASK_WDT_BACKGROUND_CHANNEL);