Skip to contentSkip to conversation

rtc: max8925: Set dev_set_drvdata before rtc_device_register

PATCH New John Stultz 1 participant 1 message Apr 27, 2011 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: max8925: Set dev_set_drvdata before rtc_device_register

From: Zhangfei Gao <[email protected]>

We now call rtc_read_alarm from rtc_device_register, so it
is important that the rtc device is fully initialized prior to reigstration.

Because of this, With rtc-max8925, we see NULL pointer errors, so call dev_set_drvdata before rtc_device_register

Thomas: This should go in for 2.6.39.

CC Alessandro Zummo <[email protected]>
CC Thomas Gleixner <[email protected]>
[Reworded commit message -jstultz]
---
 drivers/rtc/rtc-max8925.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/rtc/rtc-max8925.c +2 -1
index 174036d..20494b5 100644
@@ -257,6 +257,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
 		goto out_irq;
 	}
 
+	dev_set_drvdata(&pdev->dev, info);
+
 	info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev,
 					&max8925_rtc_ops, THIS_MODULE);
 	ret = PTR_ERR(info->rtc_dev);
@@ -265,7 +267,6 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
 		goto out_rtc;
 	}
 
-	dev_set_drvdata(&pdev->dev, info);
 	platform_set_drvdata(pdev, info);
 
 	return 0;
Signature · 1 line
1.7.3.2.146.gca209