diff mbox

Re: [PATCH] fix driver data issues in several rtc drivers

Message ID 20090923090908.7347fdf4@hcegtvedt.norway.atmel.com
State Superseded, archived
Headers show

Commit Message

Hans-Christian Egtvedt Sept. 23, 2009, 7:09 a.m. UTC
On Tue, 22 Sep 2009 22:36:10 +0200
Alessandro Zummo <alessandro.zummo@towertech.it> wrote:

> 
>  Herton Ronaldo Krzesinski recently raised up, and fixed,
>  an issue with the rtc_cmos driver, which was referring
>  to an inconsistent driver data.
> 
>  I have checked every single driver and fixed similar
>  bugs. Driver authors are advised to verify my corrections.
>

Thanks for the fix for at32ap700x rtc, I've modified it a bit to also
include a quick cleanup if a later call fails.

>  While the bug it's not easy to trigger, it would be fine
>  if we can get this fix in the kernel asap. The patch is against
>  latest git.
> 
>  Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>

<snipp diff>

From 42d244ca330c2f2e1e20407ea9d9212c78e05a83 Mon Sep 17 00:00:00 2001
From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Date: Wed, 23 Sep 2009 09:03:17 +0200
Subject: [PATCH 1/1] fix driver data issues in at32ap700x rtc driver

Register the rtc struct in platform driver data before registering the rtc.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
---
 drivers/rtc/rtc-at32ap700x.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index e1ec33e..8825695 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -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);