aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tbogendoerfer@suse.de>2019-04-11 10:33:21 -0400
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-04-12 06:23:20 -0400
commit692802d26b3ae3578fe77ada89b58217fe1c3d75 (patch)
tree21ac4f10766b86eff74724b41cf1c15e8225c264
parent7342e2a73a37ab936e4cabdfdc1b868c898bb805 (diff)
rtc: ds1685: fix crash caused by referencing wrong device struct
sysfs entries added by rtc_add_group are called with the rtc device as argument and not the underlying device. Fixed by using the dev->parent Fixes: cfb74916e2ec ("rtc: ds1685: use rtc_add_group") Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--drivers/rtc/rtc-ds1685.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 2710f2594c42..2f5194df239e 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -1004,7 +1004,7 @@ static ssize_t
1004ds1685_rtc_sysfs_battery_show(struct device *dev, 1004ds1685_rtc_sysfs_battery_show(struct device *dev,
1005 struct device_attribute *attr, char *buf) 1005 struct device_attribute *attr, char *buf)
1006{ 1006{
1007 struct ds1685_priv *rtc = dev_get_drvdata(dev); 1007 struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
1008 u8 ctrld; 1008 u8 ctrld;
1009 1009
1010 ctrld = rtc->read(rtc, RTC_CTRL_D); 1010 ctrld = rtc->read(rtc, RTC_CTRL_D);
@@ -1024,7 +1024,7 @@ static ssize_t
1024ds1685_rtc_sysfs_auxbatt_show(struct device *dev, 1024ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
1025 struct device_attribute *attr, char *buf) 1025 struct device_attribute *attr, char *buf)
1026{ 1026{
1027 struct ds1685_priv *rtc = dev_get_drvdata(dev); 1027 struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
1028 u8 ctrl4a; 1028 u8 ctrl4a;
1029 1029
1030 ds1685_rtc_switch_to_bank1(rtc); 1030 ds1685_rtc_switch_to_bank1(rtc);
@@ -1046,7 +1046,7 @@ static ssize_t
1046ds1685_rtc_sysfs_serial_show(struct device *dev, 1046ds1685_rtc_sysfs_serial_show(struct device *dev,
1047 struct device_attribute *attr, char *buf) 1047 struct device_attribute *attr, char *buf)
1048{ 1048{
1049 struct ds1685_priv *rtc = dev_get_drvdata(dev); 1049 struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
1050 u8 ssn[8]; 1050 u8 ssn[8];
1051 1051
1052 ds1685_rtc_switch_to_bank1(rtc); 1052 ds1685_rtc_switch_to_bank1(rtc);