[-next] pinctrl: at91-pio4: remove redundant return value check of platform_get_resource()

Message ID 1531312447-134423-1-git-send-email-weiyongjun1@huawei.com
State New
Headers show
Series
  • [-next] pinctrl: at91-pio4: remove redundant return value check of platform_get_resource()
Related show

Commit Message

Wei Yongjun July 11, 2018, 12:34 p.m.
Remove unneeded error handling on the result of a call
to platform_get_resource() when the value is passed to
devm_ioremap_resource().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/pinctrl/pinctrl-at91-pio4.c | 4 ----
 1 file changed, 4 deletions(-)




--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Alexandre Belloni July 11, 2018, 1:03 p.m. | #1
On 11/07/2018 12:34:07+0000, Wei Yongjun wrote:
> Remove unneeded error handling on the result of a call
> to platform_get_resource() when the value is passed to
> devm_ioremap_resource().
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

I'm not sure it is worth the effort but

Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/pinctrl/pinctrl-at91-pio4.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index 8f06197..ef7ab20 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -971,10 +971,6 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
>  	atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(dev, "unable to get atmel pinctrl resource\n");
> -		return -EINVAL;
> -	}
>  	atmel_pioctrl->reg_base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(atmel_pioctrl->reg_base))
>  		return -EINVAL;
> 
> 
>
Ludovic Desroches July 11, 2018, 2:10 p.m. | #2
On Wed, Jul 11, 2018 at 03:03:49PM +0200, Alexandre Belloni wrote:
> On 11/07/2018 12:34:07+0000, Wei Yongjun wrote:
> > Remove unneeded error handling on the result of a call
> > to platform_get_resource() when the value is passed to
> > devm_ioremap_resource().
> > 
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> I'm not sure it is worth the effort but

I have the same feeling. If it's the trend:
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

> 
> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> > ---
> >  drivers/pinctrl/pinctrl-at91-pio4.c | 4 ----
> >  1 file changed, 4 deletions(-)
> > 
> > diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> > index 8f06197..ef7ab20 100644
> > --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> > +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> > @@ -971,10 +971,6 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
> >  	atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK;
> >  
> >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -	if (!res) {
> > -		dev_err(dev, "unable to get atmel pinctrl resource\n");
> > -		return -EINVAL;
> > -	}
> >  	atmel_pioctrl->reg_base = devm_ioremap_resource(dev, res);
> >  	if (IS_ERR(atmel_pioctrl->reg_base))
> >  		return -EINVAL;
> > 
> > 
> > 
> 
> -- 
> Alexandre Belloni, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij July 13, 2018, 7:43 a.m. | #3
On Wed, Jul 11, 2018 at 2:25 PM Wei Yongjun <weiyongjun1@huawei.com> wrote:

> Remove unneeded error handling on the result of a call
> to platform_get_resource() when the value is passed to
> devm_ioremap_resource().
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Patch applied with the ACKs.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 8f06197..ef7ab20 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -971,10 +971,6 @@  static int atmel_pinctrl_probe(struct platform_device *pdev)
 	atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "unable to get atmel pinctrl resource\n");
-		return -EINVAL;
-	}
 	atmel_pioctrl->reg_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(atmel_pioctrl->reg_base))
 		return -EINVAL;