Patchwork rtc: rtc-stmp3xxx: Check the return value from stmp_reset_block()

login
register
mail settings
Submitter Fabio Estevam
Date July 3, 2013, 7:37 p.m.
Message ID <1372880252-23269-1-git-send-email-festevam@gmail.com>
Download mbox | patch
Permalink /patch/256731/
State New
Headers show

Comments

Fabio Estevam - July 3, 2013, 7:37 p.m.
From: Fabio Estevam <fabio.estevam@freescale.com>

stmp_reset_block() may fail, so let's check its return value and propagate it in
the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/rtc/rtc-stmp3xxx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Shawn Guo - July 4, 2013, 6:49 a.m.
On Wed, Jul 03, 2013 at 04:37:32PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> stmp_reset_block() may fail, so let's check its return value and propagate it in
> the case of error.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Acked-by: Shawn Guo <shawn.guo@linaro.org>

Patch

diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index 90a3e86..767fee2 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -261,7 +261,12 @@  static int stmp3xxx_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, rtc_data);
 
-	stmp_reset_block(rtc_data->io);
+	err = stmp_reset_block(rtc_data->io);
+	if (err) {
+		dev_err(&pdev->dev, "stmp_reset_block failed: %d\n", err);
+		return err;
+	}
+
 	writel(STMP3XXX_RTC_PERSISTENT0_ALARM_EN |
 			STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN |
 			STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE,