aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-max8925.c
diff options
context:
space:
mode:
authorZhangfei Gao <zhangfei.gao@marvell.com>2011-04-27 14:44:29 -0400
committerThomas Gleixner <tglx@linutronix.de>2011-04-28 05:16:21 -0400
commitf945a3d9600633de589ce698233b34ff6ad57e55 (patch)
tree61032ef1fe4917f1a505d9a3ea517b1bc54ee502 /drivers/rtc/rtc-max8925.c
parente8dad69408a9812d6bb42d03e74d2c314534a4fa (diff)
rtc: max8925: Call dev_set_drvdata before rtc_device_register
We call rtc_read_alarm from rtc_device_register, so it is important that the rtc device is fully initialized prior to registration. rtc-max8925 sets drvdata after register, so the rtc_read_alarm code dereferences a NULL pointer. Call dev_set_drvdata before rtc_device_register. [ jstultz/tglx: Massaged commit message ] Signed-off-by: Zhangfei Gao <zhangfei.gao@marvell.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Link: http://lkml.kernel.org/r/%3C1303929869-25249-1-git-send-email-john.stultz%40linaro.org%3E Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/rtc/rtc-max8925.c')
-rw-r--r--drivers/rtc/rtc-max8925.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c
index 174036dda786..20494b5edc3c 100644
--- a/drivers/rtc/rtc-max8925.c
+++ b/drivers/rtc/rtc-max8925.c
@@ -257,6 +257,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
257 goto out_irq; 257 goto out_irq;
258 } 258 }
259 259
260 dev_set_drvdata(&pdev->dev, info);
261
260 info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, 262 info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev,
261 &max8925_rtc_ops, THIS_MODULE); 263 &max8925_rtc_ops, THIS_MODULE);
262 ret = PTR_ERR(info->rtc_dev); 264 ret = PTR_ERR(info->rtc_dev);
@@ -265,7 +267,6 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
265 goto out_rtc; 267 goto out_rtc;
266 } 268 }
267 269
268 dev_set_drvdata(&pdev->dev, info);
269 platform_set_drvdata(pdev, info); 270 platform_set_drvdata(pdev, info);
270 271
271 return 0; 272 return 0;