Skip to content

Commit 3f34892

Browse files
miquelraynalalexandrebelloni
authored andcommitted
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: be4a11c ("rtc: rzn1: Add oscillator offset support") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0b6da78 commit 3f34892

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/rtc/rtc-rzn1.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ static int rzn1_rtc_read_offset(struct device *dev, long *offset)
270270
static int rzn1_rtc_set_offset(struct device *dev, long offset)
271271
{
272272
struct rzn1_rtc *rtc = dev_get_drvdata(dev);
273-
unsigned int steps;
274-
int stepsh, stepsl;
273+
int stepsh, stepsl, steps;
275274
u32 subu = 0, ctl2;
276275
int ret;
277276

0 commit comments

Comments
 (0)