Commit 692802d2 authored by Thomas Bogendoerfer's avatar Thomas Bogendoerfer Committed by Alexandre Belloni

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: cfb74916 ("rtc: ds1685: use rtc_add_group")
Signed-off-by: default avatarThomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 7342e2a7
...@@ -1004,7 +1004,7 @@ static ssize_t ...@@ -1004,7 +1004,7 @@ static ssize_t
ds1685_rtc_sysfs_battery_show(struct device *dev, ds1685_rtc_sysfs_battery_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ds1685_priv *rtc = dev_get_drvdata(dev); struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
u8 ctrld; u8 ctrld;
ctrld = rtc->read(rtc, RTC_CTRL_D); ctrld = rtc->read(rtc, RTC_CTRL_D);
...@@ -1024,7 +1024,7 @@ static ssize_t ...@@ -1024,7 +1024,7 @@ static ssize_t
ds1685_rtc_sysfs_auxbatt_show(struct device *dev, ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ds1685_priv *rtc = dev_get_drvdata(dev); struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
u8 ctrl4a; u8 ctrl4a;
ds1685_rtc_switch_to_bank1(rtc); ds1685_rtc_switch_to_bank1(rtc);
...@@ -1046,7 +1046,7 @@ static ssize_t ...@@ -1046,7 +1046,7 @@ static ssize_t
ds1685_rtc_sysfs_serial_show(struct device *dev, ds1685_rtc_sysfs_serial_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ds1685_priv *rtc = dev_get_drvdata(dev); struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
u8 ssn[8]; u8 ssn[8];
ds1685_rtc_switch_to_bank1(rtc); ds1685_rtc_switch_to_bank1(rtc);
......
Markdown is supported
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