rtc: gamecube: Always reset HW_SRNPROT after read
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Tue, 23 Aug 2022 13:07:02 +0000 (15:07 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 23 Aug 2022 20:27:58 +0000 (22:27 +0200)
commit509451ac03eb3afa4c4a32d4c11b1938f08de8e4
tree3181eea199c128fab74776008b5dd3cc6a0126de
parent1e2585b49d849196f359bbf86677943fe2d80afe
rtc: gamecube: Always reset HW_SRNPROT after read

This register would fail to be reset if reading the RTC bias failed for
whichever reason.  This commit reorganises the code around to
unconditionally write it back to its previous value, unmap it, and
return the result of regmap_read(), which makes it both simpler and more
correct in the error case.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220823130702.1046-1-linkmauve@linkmauve.fr
drivers/rtc/rtc-gamecube.c