linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org, kernel@pengutronix.de
Subject: Re: [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure
Date: Sun, 6 Nov 2016 18:29:20 +0100	[thread overview]
Message-ID: <20161106182920.3215ea1a@bbrezillon> (raw)
In-Reply-To: <1474276878-1021-1-git-send-email-u.kleine-koenig@pengutronix.de>

On Mon, 19 Sep 2016 11:21:18 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> For some error paths alloc_nand_resource() emitted an error message, for
> others it didn't. Make it consistently print a message including the
> error code where it's not constant and drop the hardly helpful
> additional message printed by the caller of alloc_nand_resource.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied after addressing Marek and Robert comments.

Thanks,

Boris

> ---
>  drivers/mtd/nand/pxa3xx_nand.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index 436dd6dc11f4..052e9725cf12 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -1774,8 +1774,11 @@ static int alloc_nand_resource(struct platform_device *pdev)
>  	int ret, irq, cs;
>  
>  	pdata = dev_get_platdata(&pdev->dev);
> -	if (pdata->num_cs <= 0)
> +	if (pdata->num_cs <= 0) {
> +		dev_err(&pdev->dev, "broken number of chip selects\n");
>  		return -ENODEV;
> +	}
> +
>  	info = devm_kzalloc(&pdev->dev,
>  			    sizeof(*info) + sizeof(*host) * pdata->num_cs,
>  			    GFP_KERNEL);
> @@ -1814,8 +1817,9 @@ static int alloc_nand_resource(struct platform_device *pdev)
>  	init_waitqueue_head(&chip->controller->wq);
>  	info->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(info->clk)) {
> -		dev_err(&pdev->dev, "failed to get nand clock\n");
> -		return PTR_ERR(info->clk);
> +		ret = PTR_ERR(info->clk);
> +		dev_err(&pdev->dev, "failed to get nand clock (%d)\n", ret);
> +		return ret;
>  	}
>  	ret = clk_prepare_enable(info->clk);
>  	if (ret < 0)
> @@ -1843,6 +1847,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
>  	info->mmio_base = devm_ioremap_resource(&pdev->dev, r);
>  	if (IS_ERR(info->mmio_base)) {
>  		ret = PTR_ERR(info->mmio_base);
> +		dev_err(&pdev->dev, "failed to map register space (%d)\n", ret);
>  		goto fail_disable_clk;
>  	}
>  	info->mmio_phys = r->start;
> @@ -1862,7 +1867,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
>  				   pxa3xx_nand_irq_thread, IRQF_ONESHOT,
>  				   pdev->name, info);
>  	if (ret < 0) {
> -		dev_err(&pdev->dev, "failed to request IRQ\n");
> +		dev_err(&pdev->dev, "failed to request IRQ (%d)\n", ret);
>  		goto fail_free_buf;
>  	}
>  
> @@ -1961,10 +1966,8 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
>  	}
>  
>  	ret = alloc_nand_resource(pdev);
> -	if (ret) {
> -		dev_err(&pdev->dev, "alloc nand resource failed\n");
> +	if (ret)
>  		return ret;
> -	}
>  
>  	info = platform_get_drvdata(pdev);
>  	probe_success = 0;

      parent reply	other threads:[~2016-11-06 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19  9:21 [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure Uwe Kleine-König
2016-10-28  8:04 ` Boris Brezillon
2016-10-29 17:56   ` Marek Vasut
2016-10-29 19:07     ` Boris Brezillon
2016-10-29 19:59     ` Robert Jarzmik
2016-11-06 17:29 ` Boris Brezillon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161106182920.3215ea1a@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).