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>

authored by Zhangfei Gao and committed by Thomas Gleixner f945a3d9 e8dad694

+2 -1
+2 -1
drivers/rtc/rtc-max8925.c
··· 257 257 goto out_irq; 258 258 } 259 259 260 + dev_set_drvdata(&pdev->dev, info); 261 + 260 262 info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, 261 263 &max8925_rtc_ops, THIS_MODULE); 262 264 ret = PTR_ERR(info->rtc_dev); ··· 267 265 goto out_rtc; 268 266 } 269 267 270 - dev_set_drvdata(&pdev->dev, info); 271 268 platform_set_drvdata(pdev, info); 272 269 273 270 return 0;