public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: rtc-at91rm9200: fix missing iounmap
@ 2013-04-11 14:38 Johan Hovold
  2013-04-19 10:19 ` Nicolas Ferre
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2013-04-11 14:38 UTC (permalink / raw)
  To: Alessandro Zummo, Nicolas Ferre
  Cc: rtc-linux, linux-kernel, Johan Hovold, stable

Add missing iounmap to probe error path and remove.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
 drivers/rtc/rtc-at91rm9200.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 434ebc3..eebd8ac 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -297,7 +297,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 				"at91_rtc", pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
-		return ret;
+		goto err_unmap;
 	}
 
 	/* cpu init code should really have flagged this device as
@@ -309,13 +309,20 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 	rtc = rtc_device_register(pdev->name, &pdev->dev,
 				&at91_rtc_ops, THIS_MODULE);
 	if (IS_ERR(rtc)) {
-		free_irq(irq, pdev);
-		return PTR_ERR(rtc);
+		ret = PTR_ERR(rtc);
+		goto err_free_irq;
 	}
 	platform_set_drvdata(pdev, rtc);
 
 	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
 	return 0;
+
+err_free_irq:
+	free_irq(irq, pdev);
+err_unmap:
+	iounmap(at91_rtc_regs);
+
+	return ret;
 }
 
 /*
@@ -332,6 +339,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
 	free_irq(irq, pdev);
 
 	rtc_device_unregister(rtc);
+	iounmap(at91_rtc_regs);
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: rtc-at91rm9200: fix missing iounmap
  2013-04-11 14:38 [PATCH] rtc: rtc-at91rm9200: fix missing iounmap Johan Hovold
@ 2013-04-19 10:19 ` Nicolas Ferre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Ferre @ 2013-04-19 10:19 UTC (permalink / raw)
  To: Alessandro Zummo, rtc-linux
  Cc: Johan Hovold, linux-kernel, stable, Andrew Morton

On 04/11/2013 04:38 PM, Johan Hovold :
> Add missing iounmap to probe error path and remove.
> 
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Johan Hovold <jhovold@gmail.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Andrew, can you take this one please?
(https://patchwork.kernel.org/patch/2429031/)


Best regards,

> ---
>  drivers/rtc/rtc-at91rm9200.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
> index 434ebc3..eebd8ac 100644
> --- a/drivers/rtc/rtc-at91rm9200.c
> +++ b/drivers/rtc/rtc-at91rm9200.c
> @@ -297,7 +297,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
>  				"at91_rtc", pdev);
>  	if (ret) {
>  		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
> -		return ret;
> +		goto err_unmap;
>  	}
>  
>  	/* cpu init code should really have flagged this device as
> @@ -309,13 +309,20 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
>  	rtc = rtc_device_register(pdev->name, &pdev->dev,
>  				&at91_rtc_ops, THIS_MODULE);
>  	if (IS_ERR(rtc)) {
> -		free_irq(irq, pdev);
> -		return PTR_ERR(rtc);
> +		ret = PTR_ERR(rtc);
> +		goto err_free_irq;
>  	}
>  	platform_set_drvdata(pdev, rtc);
>  
>  	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
>  	return 0;
> +
> +err_free_irq:
> +	free_irq(irq, pdev);
> +err_unmap:
> +	iounmap(at91_rtc_regs);
> +
> +	return ret;
>  }
>  
>  /*
> @@ -332,6 +339,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
>  	free_irq(irq, pdev);
>  
>  	rtc_device_unregister(rtc);
> +	iounmap(at91_rtc_regs);
>  	platform_set_drvdata(pdev, NULL);
>  
>  	return 0;
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-19 10:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11 14:38 [PATCH] rtc: rtc-at91rm9200: fix missing iounmap Johan Hovold
2013-04-19 10:19 ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox