[PATCH] rtc: rzn1: Fix a variable type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
 drivers/rtc/rtc-rzn1.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index bdd4ebd5c887..66405b43ae7e 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;
 
-- 
2.34.1




[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux