* [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure
@ 2016-09-19 9:21 Uwe Kleine-König
2016-10-28 8:04 ` Boris Brezillon
2016-11-06 17:29 ` Boris Brezillon
0 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2016-09-19 9:21 UTC (permalink / raw)
To: Ezequiel Garcia; +Cc: Boris Brezillon, Richard Weinberger, linux-mtd, kernel
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>
---
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;
--
2.8.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure
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-11-06 17:29 ` Boris Brezillon
1 sibling, 1 reply; 6+ messages in thread
From: Boris Brezillon @ 2016-10-28 8:04 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Ezequiel Garcia, Richard Weinberger, linux-mtd, kernel,
Robert Jarzmik, Ezequiel Garcia
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>
It looks good to me. Ezequiel, Robert, any objection to this patch? If
not, can I have your Acked/Reviewed-by ?
> ---
> 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;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure
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
0 siblings, 2 replies; 6+ messages in thread
From: Marek Vasut @ 2016-10-29 17:56 UTC (permalink / raw)
To: Boris Brezillon, Uwe Kleine-König
Cc: Ezequiel Garcia, Richard Weinberger, linux-mtd, Ezequiel Garcia,
kernel, Robert Jarzmik
On 10/28/2016 10:04 AM, Boris Brezillon wrote:
> 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>
>
> It looks good to me. Ezequiel, Robert, any objection to this patch? If
> not, can I have your Acked/Reviewed-by ?
>
>> ---
>> 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");
Not: Should be "invalid number of chip selects" . Also, if you turn the
num_cs to unsigned type in the platdata, the test can be if (foo == 0)
instead.
>> 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;
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure
2016-10-29 17:56 ` Marek Vasut
@ 2016-10-29 19:07 ` Boris Brezillon
2016-10-29 19:59 ` Robert Jarzmik
1 sibling, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2016-10-29 19:07 UTC (permalink / raw)
To: Marek Vasut
Cc: Uwe Kleine-König, Ezequiel Garcia, Richard Weinberger,
linux-mtd, Ezequiel Garcia, kernel, Robert Jarzmik
On Sat, 29 Oct 2016 19:56:39 +0200
Marek Vasut <marek.vasut@gmail.com> wrote:
> On 10/28/2016 10:04 AM, Boris Brezillon wrote:
> > 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>
> >
> > It looks good to me. Ezequiel, Robert, any objection to this patch? If
> > not, can I have your Acked/Reviewed-by ?
> >
> >> ---
> >> 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");
>
> Not: Should be "invalid number of chip selects" .
Correct. I can fix that when applying.
> Also, if you turn the
> num_cs to unsigned type in the platdata, the test can be if (foo == 0)
> instead.
If we really want to turn num_cs into an unsigned int, then it should
be done in different patch, but honestly, that's not the first thing I
would rework in this driver ;-).
>
> >> 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;
> >
> >
> > ______________________________________________________
> > Linux MTD discussion mailing list
> > http://lists.infradead.org/mailman/listinfo/linux-mtd/
> >
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure
2016-10-29 17:56 ` Marek Vasut
2016-10-29 19:07 ` Boris Brezillon
@ 2016-10-29 19:59 ` Robert Jarzmik
1 sibling, 0 replies; 6+ messages in thread
From: Robert Jarzmik @ 2016-10-29 19:59 UTC (permalink / raw)
To: Uwe Kleine-König, Marek Vasut
Cc: Boris Brezillon, Ezequiel Garcia, Richard Weinberger, linux-mtd,
Ezequiel Garcia, kernel
Marek Vasut <marek.vasut@gmail.com> writes:
> On 10/28/2016 10:04 AM, Boris Brezillon wrote:
>> 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>
>>
>> It looks good to me. Ezequiel, Robert, any objection to this patch? If
>> not, can I have your Acked/Reviewed-by ?
Hi,
Actually I was wondering if my mail system is utterly broken ... This is the
first mail I receive, while it seems to me I was in the recipients in the former
ones ...
You can take my Reviewed-by, at least from:
https://patchwork.ozlabs.org/patch/671644/
As a side note, normally for pxa architecture we use a printk format to display
the return value as :
pr_something("XXXX :%d\n", ret)
As pxa3xx_nand is shared with other architectures this will be Boris/Ezequiel's
call.
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: write exactly one message on probe failure
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-11-06 17:29 ` Boris Brezillon
1 sibling, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2016-11-06 17:29 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Ezequiel Garcia, Richard Weinberger, linux-mtd, kernel
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;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-06 17:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).