[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170117104352.65velakwiaia36xq@piout.net>
Date: Tue, 17 Jan 2017 11:43:52 +0100
From: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To: Amelie Delaunay <amelie.delaunay@...com>
Cc: Alessandro Zummo <a.zummo@...ertech.it>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...com>,
Russell King <linux@...linux.org.uk>,
rtc-linux@...glegroups.com, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Gabriel Fernandez <gabriel.fernandez@...com>
Subject: Re: [PATCH] rtc: stm32: fix comparison warnings
On 16/01/2017 at 11:08:53 +0100, Amelie Delaunay wrote :
> This patches fixes comparison between signed and unsigned values as it
> could produce an incorrect result when the signed value is converted to
> unsigned:
>
> drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_valid_alrm':
> drivers/rtc/rtc-stm32.c:404:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
> if ((((tm->tm_year > cur_year) &&
> ...
>
> It also fixes comparison always true or false due to the fact that unsigned
> value is compared against zero with >= or <:
>
> drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_init':
> drivers/rtc/rtc-stm32.c:514:35: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> for (pred_a = pred_a_max; pred_a >= 0; pred_a-- ) {
>
> drivers/rtc/rtc-stm32.c:530:44: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> (rate - ((pred_a + 1) * (pred_s + 1)) < 0) ?
>
> Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver")
> Signed-off-by: Amelie Delaunay <amelie.delaunay@...com>
> ---
> drivers/rtc/rtc-stm32.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Powered by blists - more mailing lists