From 1496b4895e4f5eb921716103bef13329aab7d92e Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Wed, 7 Jun 2017 16:42:26 +0200 Subject: [PATCH] delay_timer: correct sparse issues and warnings Use NULL instead of 0 where required. Include headers to have the prototype of the functions. Signed-off-by: Yann Gautier Signed-off-by: Etienne Carriere --- drivers/delay_timer/delay_timer.c | 8 ++++---- drivers/delay_timer/generic_delay_timer.c | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/delay_timer/delay_timer.c b/drivers/delay_timer/delay_timer.c index 403c60fd..43f5af7b 100644 --- a/drivers/delay_timer/delay_timer.c +++ b/drivers/delay_timer/delay_timer.c @@ -19,10 +19,10 @@ static const timer_ops_t *ops; ***********************************************************/ void udelay(uint32_t usec) { - assert(ops != 0 && + assert(ops != NULL && (ops->clk_mult != 0) && (ops->clk_div != 0) && - (ops->get_timer_value != 0)); + (ops->get_timer_value != NULL)); uint32_t start, delta, total_delta; @@ -57,10 +57,10 @@ void mdelay(uint32_t msec) ***********************************************************/ void timer_init(const timer_ops_t *ops_ptr) { - assert(ops_ptr != 0 && + assert(ops_ptr != NULL && (ops_ptr->clk_mult != 0) && (ops_ptr->clk_div != 0) && - (ops_ptr->get_timer_value != 0)); + (ops_ptr->get_timer_value != NULL)); ops = ops_ptr; } diff --git a/drivers/delay_timer/generic_delay_timer.c b/drivers/delay_timer/generic_delay_timer.c index 6a9d3147..8a36c8ab 100644 --- a/drivers/delay_timer/generic_delay_timer.c +++ b/drivers/delay_timer/generic_delay_timer.c @@ -9,6 +9,7 @@ #include #include #include +#include #include /* Ticks elapsed in one second by a signal of 1 MHz */ -- 2.30.2