summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorPrashant Gaikwad <pgaikwad@nvidia.com>2011-08-26 18:55:07 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:48:37 -0800
commit911b415d278fb30ad3887827e09efc745457ab0e (patch)
tree4ee0b013bb9ecb54bdf8c831326eaa547136f347 /drivers/rtc
parentd8f3a191f6c88e2a0ecb402af0670b71c477c6d7 (diff)
rtc: max8907c: fix startup crash
The rtc_device_register() call has changed semantics so that it will immediately call out to rtc_read_alarm() and since the callbacks require the drvdata to be set, we need to set it before the registration call to valid NULL dereference. Based on 21b398e9670f0bb8f05b7b4cd03e018e8a0b7522 Change-Id: I4960a180ffb63415310bf9fce05de155d0633337 Reviewed-on: http://git-master/r/49460 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: Rb5896ff9928b249d97c263e1647ca451e0380b74
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-max8907c.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-max8907c.c b/drivers/rtc/rtc-max8907c.c
index 936f133f67c1..668bc43461ba 100644
--- a/drivers/rtc/rtc-max8907c.c
+++ b/drivers/rtc/rtc-max8907c.c
@@ -229,6 +229,7 @@ static int __devinit max8907c_rtc_probe(struct platform_device *pdev)
goto out_irq;
}
+ dev_set_drvdata(&pdev->dev, info);
info->rtc_dev = rtc_device_register("max8907c-rtc", &pdev->dev,
&max8907c_rtc_ops, THIS_MODULE);
ret = PTR_ERR(info->rtc_dev);
@@ -239,8 +240,6 @@ static int __devinit max8907c_rtc_probe(struct platform_device *pdev)
max8907c_set_bits(chip->i2c_power, MAX8907C_REG_SYSENSEL, 0x2, 0x2);
- dev_set_drvdata(&pdev->dev, info);
-
platform_set_drvdata(pdev, info);
device_init_wakeup(&pdev->dev, 1);