diff mbox series

[04/11] mmc: jz4740: Simplify with dev_err_probe()

Message ID 20200902193658.20539-5-krzk@kernel.org (mailing list archive)
State New, archived
Headers show
Series mmc: Minor cleanups and compile test | expand

Commit Message

Krzysztof Kozlowski Sept. 2, 2020, 7:36 p.m. UTC
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/mmc/host/jz4740_mmc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Paul Cercueil Sept. 3, 2020, 10:49 a.m. UTC | #1
Hi Krzysztof,

Le mer. 2 sept. 2020 à 21:36, Krzysztof Kozlowski <krzk@kernel.org> a 
écrit :
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and the error value gets printed.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/mmc/host/jz4740_mmc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/jz4740_mmc.c 
> b/drivers/mmc/host/jz4740_mmc.c
> index 81d71010b474..0c5b52b53303 100644
> --- a/drivers/mmc/host/jz4740_mmc.c
> +++ b/drivers/mmc/host/jz4740_mmc.c
> @@ -991,9 +991,8 @@ static int jz4740_mmc_probe(struct 
> platform_device* pdev)
> 
>  	ret = mmc_of_parse(mmc);
>  	if (ret) {
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(&pdev->dev,
> -				"could not parse device properties: %d\n", ret);
> +		dev_err_probe(&pdev->dev, ret,
> +			      "could not parse device properties\n");

I think you can put that on one line.

With that said:
Reviewed-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

>  		goto err_free_host;
>  	}
> 
> --
> 2.17.1
>
Ulf Hansson Sept. 3, 2020, 11:47 a.m. UTC | #2
On Thu, 3 Sep 2020 at 12:50, Paul Cercueil <paul@crapouillou.net> wrote:
>
> Hi Krzysztof,
>
> Le mer. 2 sept. 2020 à 21:36, Krzysztof Kozlowski <krzk@kernel.org> a
> écrit :
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and the error value gets printed.
> >
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > ---
> >  drivers/mmc/host/jz4740_mmc.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/mmc/host/jz4740_mmc.c
> > b/drivers/mmc/host/jz4740_mmc.c
> > index 81d71010b474..0c5b52b53303 100644
> > --- a/drivers/mmc/host/jz4740_mmc.c
> > +++ b/drivers/mmc/host/jz4740_mmc.c
> > @@ -991,9 +991,8 @@ static int jz4740_mmc_probe(struct
> > platform_device* pdev)
> >
> >       ret = mmc_of_parse(mmc);
> >       if (ret) {
> > -             if (ret != -EPROBE_DEFER)
> > -                     dev_err(&pdev->dev,
> > -                             "could not parse device properties: %d\n", ret);
> > +             dev_err_probe(&pdev->dev, ret,
> > +                           "could not parse device properties\n");
>
> I think you can put that on one line.

I can amend the patch when I rebase my branch next week, no need for a resend.

>
> With that said:
> Reviewed-by: Paul Cercueil <paul@crapouillou.net>

And I add your tag as well, thanks!

Kind regards
Uffe

>
> Cheers,
> -Paul
>
> >               goto err_free_host;
> >       }
> >
> > --
> > 2.17.1
> >
>
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index 81d71010b474..0c5b52b53303 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -991,9 +991,8 @@  static int jz4740_mmc_probe(struct platform_device* pdev)
 
 	ret = mmc_of_parse(mmc);
 	if (ret) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev,
-				"could not parse device properties: %d\n", ret);
+		dev_err_probe(&pdev->dev, ret,
+			      "could not parse device properties\n");
 		goto err_free_host;
 	}