From: Miquel Raynal Date: Fri, 20 May 2022 08:25:00 +0000 (+0200) Subject: rtc: rzn1: Fix a variable type X-Git-Tag: v5.19-rc1~71^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=3f3489248927a53fcfec571ff603163f6b676a46;p=linux-block.git rtc: rzn1: Fix a variable type The calculation in ->set_offset() handles both negative and positive offsets. The 'steps' variable will be checked to be in a specific [-x; +x] range, which means it must be a signed integer rather than unsigned. This also fixes the following smatch warning: warn: 'steps' 'true' implies 'steps > 0' is 'true' Fixes: be4a11cf98af ("rtc: rzn1: Add oscillator offset support") Reported-by: Dan Carpenter Signed-off-by: Miquel Raynal Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220520082500.489248-1-miquel.raynal@bootlin.com --- diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c index 18f33ca62f6c..ac788799c8e3 100644 --- a/drivers/rtc/rtc-rzn1.c +++ b/drivers/rtc/rtc-rzn1.c @@ -270,8 +270,7 @@ static int rzn1_rtc_read_offset(struct device *dev, long *offset) static int rzn1_rtc_set_offset(struct device *dev, long offset) { struct rzn1_rtc *rtc = dev_get_drvdata(dev); - unsigned int steps; - int stepsh, stepsl; + int stepsh, stepsl, steps; u32 subu = 0, ctl2; int ret;