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
@@ -481,6 +481,9 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
|
||||
goto out;
|
||||
}
|
||||
|
||||
spin_lock_init(&m48t59->lock);
|
||||
platform_set_drvdata(pdev, m48t59);
|
||||
|
||||
m48t59->rtc = rtc_device_register(name, &pdev->dev, ops, THIS_MODULE);
|
||||
if (IS_ERR(m48t59->rtc)) {
|
||||
ret = PTR_ERR(m48t59->rtc);
|
||||
@@ -490,16 +493,14 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
|
||||
m48t59_nvram_attr.size = pdata->offset;
|
||||
|
||||
ret = sysfs_create_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
rtc_device_unregister(m48t59->rtc);
|
||||
goto out;
|
||||
}
|
||||
|
||||
spin_lock_init(&m48t59->lock);
|
||||
platform_set_drvdata(pdev, m48t59);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
if (!IS_ERR(m48t59->rtc))
|
||||
rtc_device_unregister(m48t59->rtc);
|
||||
if (m48t59->irq != NO_IRQ)
|
||||
free_irq(m48t59->irq, &pdev->dev);
|
||||
if (m48t59->ioaddr)
|
||||
|
Reference in New Issue
Block a user