aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorNicholas Mc Guire <hofrat@osadl.org>2019-05-09 04:13:55 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-05-23 17:42:25 +0200
commit8aec4b875008b98349222f3fbe8b86051d0fab4f (patch)
tree3b7067e25cfff4c28608dfa68431264421876527 /drivers/rtc
parentLinux 5.2-rc1 (diff)
downloadlinux-dev-8aec4b875008b98349222f3fbe8b86051d0fab4f.tar.xz
linux-dev-8aec4b875008b98349222f3fbe8b86051d0fab4f.zip
rtc: ds2404: use hw endiannes variable
Converting from hardware to host endiannes was done using reassignment to the same variable which makes sparse unhappy as it can not verify the endiannes handling properly. To allow sparse to verify endiannes handling an explicit __le32 is introduced. Note that this patch does not change the generated binary (x86_64 and ppc64 binary diff). Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-ds2404.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c
index 1e9f429ada64..9df0c44512b8 100644
--- a/drivers/rtc/rtc-ds2404.c
+++ b/drivers/rtc/rtc-ds2404.c
@@ -182,9 +182,10 @@ static void ds2404_enable_osc(struct device *dev)
static int ds2404_read_time(struct device *dev, struct rtc_time *dt)
{
unsigned long time = 0;
+ __le32 hw_time = 0;
- ds2404_read_memory(dev, 0x203, 4, (u8 *)&time);
- time = le32_to_cpu(time);
+ ds2404_read_memory(dev, 0x203, 4, (u8 *)&hw_time);
+ time = le32_to_cpu(hw_time);
rtc_time64_to_tm(time, dt);
return 0;