diff mbox series

[-next] mmc: jz4740: Use PTR_ERR_OR_ZERO in jz4740_mmc_request_gpios()

Message ID 1543628746-101825-1-git-send-email-yuehaibing@huawei.com
State New, archived
Headers show
Series [-next] mmc: jz4740: Use PTR_ERR_OR_ZERO in jz4740_mmc_request_gpios() | expand

Commit Message

YueHaibing Dec. 1, 2018, 1:45 a.m. UTC
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/mmc/host/jz4740_mmc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Joey Pabalinas Dec. 1, 2018, 1:55 a.m. UTC | #1
On Sat, Dec 01, 2018 at 01:45:46AM +0000, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Acked-by: Joey Pabalinas <joeypabalinas@gmail.com>

On Sat, Dec 01, 2018 at 01:45:46AM +0000, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/mmc/host/jz4740_mmc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
> index 6f7a99e..8eca423 100644
> --- a/drivers/mmc/host/jz4740_mmc.c
> +++ b/drivers/mmc/host/jz4740_mmc.c
> @@ -975,10 +975,7 @@ static int jz4740_mmc_request_gpios(struct jz4740_mmc_host *host,
>  
>  	host->power = devm_gpiod_get_optional(&pdev->dev, "power",
>  					      GPIOD_OUT_HIGH);
> -	if (IS_ERR(host->power))
> -		return PTR_ERR(host->power);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(host->power);
>  }
>  
>  static const struct of_device_id jz4740_mmc_of_match[] = {
Linus Walleij Dec. 1, 2018, 12:58 p.m. UTC | #2
On Sat, Dec 1, 2018 at 2:37 AM YueHaibing <yuehaibing@huawei.com> wrote:

> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Ah, smart.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Ulf Hansson Dec. 5, 2018, 2:24 p.m. UTC | #3
On Sat, 1 Dec 2018 at 02:37, YueHaibing <yuehaibing@huawei.com> wrote:
>
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Applied for next, thanks!

Kind regards
Uffe

> ---
>  drivers/mmc/host/jz4740_mmc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
> index 6f7a99e..8eca423 100644
> --- a/drivers/mmc/host/jz4740_mmc.c
> +++ b/drivers/mmc/host/jz4740_mmc.c
> @@ -975,10 +975,7 @@ static int jz4740_mmc_request_gpios(struct jz4740_mmc_host *host,
>
>         host->power = devm_gpiod_get_optional(&pdev->dev, "power",
>                                               GPIOD_OUT_HIGH);
> -       if (IS_ERR(host->power))
> -               return PTR_ERR(host->power);
> -
> -       return 0;
> +       return PTR_ERR_OR_ZERO(host->power);
>  }
>
>  static const struct of_device_id jz4740_mmc_of_match[] = {
>
>
>
>
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index 6f7a99e..8eca423 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -975,10 +975,7 @@  static int jz4740_mmc_request_gpios(struct jz4740_mmc_host *host,
 
 	host->power = devm_gpiod_get_optional(&pdev->dev, "power",
 					      GPIOD_OUT_HIGH);
-	if (IS_ERR(host->power))
-		return PTR_ERR(host->power);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(host->power);
 }
 
 static const struct of_device_id jz4740_mmc_of_match[] = {