Commit 3f348924 authored by Miquel Raynal's avatar Miquel Raynal Committed by Alexandre Belloni

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: be4a11cf ("rtc: rzn1: Add oscillator offset support")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220520082500.489248-1-miquel.raynal@bootlin.com
parent 0b6da785
...@@ -270,8 +270,7 @@ static int rzn1_rtc_read_offset(struct device *dev, long *offset) ...@@ -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) static int rzn1_rtc_set_offset(struct device *dev, long offset)
{ {
struct rzn1_rtc *rtc = dev_get_drvdata(dev); struct rzn1_rtc *rtc = dev_get_drvdata(dev);
unsigned int steps; int stepsh, stepsl, steps;
int stepsh, stepsl;
u32 subu = 0, ctl2; u32 subu = 0, ctl2;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment