diff mbox

[3/4,media] soc_camera/sh_mobile_ceu_camera: Convert to devm_ioremap_resource()

Message ID 1362384921-7344-3-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sachin Kamat March 4, 2013, 8:15 a.m. UTC
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 .../platform/soc_camera/sh_mobile_ceu_camera.c     |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

Comments

Thierry Reding March 4, 2013, 9:13 a.m. UTC | #1
On Mon, Mar 04, 2013 at 01:45:20PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages; so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  .../platform/soc_camera/sh_mobile_ceu_camera.c     |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
> index bb08a46..be1af08 100644
> --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
> +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
> @@ -20,6 +20,7 @@
>  #include <linux/completion.h>
>  #include <linux/delay.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/err.h>
>  #include <linux/errno.h>
>  #include <linux/fs.h>
>  #include <linux/interrupt.h>
> @@ -2110,11 +2111,9 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev)
>  	pcdev->max_width = pcdev->pdata->max_width ? : 2560;
>  	pcdev->max_height = pcdev->pdata->max_height ? : 1920;
>  
> -	base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!base) {
> -		dev_err(&pdev->dev, "Unable to ioremap CEU registers.\n");
> -		return -ENXIO;
> -	}
> +	base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(base))
> +		return PTR_ERR(base);
>  
>  	pcdev->irq = irq;
>  	pcdev->base = base;

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
diff mbox

Patch

diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
index bb08a46..be1af08 100644
--- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
+++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
@@ -20,6 +20,7 @@ 
 #include <linux/completion.h>
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/interrupt.h>
@@ -2110,11 +2111,9 @@  static int sh_mobile_ceu_probe(struct platform_device *pdev)
 	pcdev->max_width = pcdev->pdata->max_width ? : 2560;
 	pcdev->max_height = pcdev->pdata->max_height ? : 1920;
 
-	base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!base) {
-		dev_err(&pdev->dev, "Unable to ioremap CEU registers.\n");
-		return -ENXIO;
-	}
+	base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	pcdev->irq = irq;
 	pcdev->base = base;