rtc: fix driver data issues in several rtc drivers
Herton Ronaldo Krzesinski recently raised up, and fixed, an issue with the rtc_cmos driver, which was referring to an inconsistent driver data. This patch ensures that driver data registration happens before rtc_device_register(). Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Thomas Hommel <thomas.hommel@gefanuc.com> Acked-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com> Acked-by: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Andrew Sharp <andy.sharp@onstor.com> Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: Alexander Bigga <ab@mycable.de> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Mark Zhan <rongkai.zhan@windriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
d1b2efa83f
commit
b74d2caa64
@@ -256,6 +256,8 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
|
||||
goto out_iounmap;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
|
||||
rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
|
||||
&at32_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(rtc->rtc)) {
|
||||
@@ -264,7 +266,6 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
|
||||
goto out_free_irq;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
device_init_wakeup(&pdev->dev, 1);
|
||||
|
||||
dev_info(&pdev->dev, "Atmel RTC for AT32AP700x at %08lx irq %ld\n",
|
||||
@@ -273,6 +274,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
|
||||
out_free_irq:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
free_irq(irq, rtc);
|
||||
out_iounmap:
|
||||
iounmap(rtc->regs);
|
||||
|
Reference in New Issue
Block a user