Skip to content
Commit 64d69b5d authored by Miquel Raynal's avatar Miquel Raynal Committed by Alexandre Belloni
Browse files

rtc: rzn1: Avoid mixing variables

In the ->set_offset() callback, the 'val' variable is used for two
different purposes at the same time, which is oviously wrong:
- It contains the intermediate value of the SUBU register that must be
  written at the end of ->set_offset().
- It is used in the middle of the above calculations to poll the CTL2
  register for a specific value.

Let's introduce a 'ctl2' variable just for the readl_poll_timeout()
call and use it there in place of 'var'.

In order to avoid mixing those two variables again, let's rename the
remaining occurences of 'val' into 'subu' and initialize it to 0 to
avoid the uninitialized variable situation reported by Tom Rix and Colin
Ian King already.

Fixes: be4a11cf

 ("rtc: rzn1: Add oscillator offset support")
Reported-by: default avatarTom Rix <trix@redhat.com>
Reported-by: default avatarColin Ian King <colin.i.king@gmail.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/20220520082221.488849-1-miquel.raynal@bootlin.com
parent b520cbe5
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