* [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) on error
@ 2016-11-04 10:42 Masahiro Yamada
2016-11-04 10:43 ` [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() " Masahiro Yamada
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-11-04 10:42 UTC (permalink / raw)
To: linux-arm-kernel
nand_scan(), nand_scan_ident(), nand_scan_tail() return
an appropriate negative value on error.
Most of drivers return the value from them on error,
but some of them return the fixed error code -ENXIO
(and a few return -ENODEV).
This series make those drivers return more precise error code.
Masahiro Yamada (22):
mtd: nand: ams-delta: return error code of nand_scan() on error
mtd: nand: cmx270: return error code of nand_scan() on error
mtd: nand: cs553x: return error code of nand_scan() on error
mtd: nand: gpio: return error code of nand_scan() on error
mtd: nand: mpc5121: return error code of nand_scan() on error
mtd: nand: tmio: return error code of nand_scan() on error
mtd: nand: orion: return error code of nand_scan() on error
mtd: nand: pasemi: return error code of nand_scan() on error
mtd: nand: plat_nand: return error code of nand_scan() on error
mtd: nand: atmel: return error code of nand_scan_ident/tail() on error
mtd: nand: brcmnand: return error code of nand_scan_ident/tail() on
error
mtd: nand: fsmc: return error code of nand_scan_ident/tail() on error
mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() on
error
mtd: nand: mediatek: return error code of nand_scan_ident/tail() on
error
mtd: nand: mxc: return error code of nand_scan_ident/tail() on error
mtd: nand: omap2: return error code of nand_scan_ident/tail() on error
mtd: nand: vf610: return error code of nand_scan_ident/tail() on error
mtd: nand: cafe: return error code of nand_scan_ident() on error
mtd: nand: hisi504: return error code of nand_scan_ident() on error
mtd: nand: pxa3xx: return error code of nand_scan_ident() on error
mtd: nand: nandsim: remove unneeded checks for nand_scan_ident/tail()
mtd: nand: socrates: use nand_scan() for nand_scan_ident/tail() combo
drivers/mtd/nand/ams-delta.c | 5 ++---
drivers/mtd/nand/atmel_nand.c | 10 ++++------
drivers/mtd/nand/brcmnand/brcmnand.c | 10 ++++++----
drivers/mtd/nand/cafe_nand.c | 5 ++---
drivers/mtd/nand/cmx270_nand.c | 4 ++--
drivers/mtd/nand/cs553x_nand.c | 5 ++---
drivers/mtd/nand/fsmc_nand.c | 9 ++++-----
drivers/mtd/nand/gpio.c | 5 ++---
drivers/mtd/nand/hisi504_nand.c | 4 +---
drivers/mtd/nand/lpc32xx_mlc.c | 10 ++++------
drivers/mtd/nand/lpc32xx_slc.c | 9 +++------
drivers/mtd/nand/mpc5121_nfc.c | 4 ++--
drivers/mtd/nand/mtk_nand.c | 4 ++--
drivers/mtd/nand/mxc_nand.c | 10 ++++------
drivers/mtd/nand/nandsim.c | 4 ----
drivers/mtd/nand/omap2.c | 9 ++++-----
drivers/mtd/nand/orion_nand.c | 5 ++---
drivers/mtd/nand/pasemi_nand.c | 5 ++---
drivers/mtd/nand/plat_nand.c | 5 ++---
drivers/mtd/nand/pxa3xx_nand.c | 5 +++--
drivers/mtd/nand/socrates_nand.c | 12 ++----------
drivers/mtd/nand/tmio_nand.c | 6 +++---
drivers/mtd/nand/vf610_nfc.c | 10 ++++------
23 files changed, 62 insertions(+), 93 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() on error
2016-11-04 10:42 [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) on error Masahiro Yamada
@ 2016-11-04 10:43 ` Masahiro Yamada
2016-11-06 1:37 ` Vladimir Zapolskiy
2016-11-06 18:27 ` Boris Brezillon
2016-11-04 10:43 ` [PATCH 14/22] mtd: nand: mediatek: " Masahiro Yamada
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-11-04 10:43 UTC (permalink / raw)
To: linux-arm-kernel
The nand_scan_ident/tail() returns an appropriate error value when
it fails. Use it instead of the fixed error code -ENXIO.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/mtd/nand/lpc32xx_mlc.c | 10 ++++------
drivers/mtd/nand/lpc32xx_slc.c | 9 +++------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
index 8523881..5553a5d 100644
--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -747,10 +747,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
* Scan to find existance of the device and
* Get the type of NAND device SMALL block or LARGE block
*/
- if (nand_scan_ident(mtd, 1, NULL)) {
- res = -ENXIO;
+ res = nand_scan_ident(mtd, 1, NULL);
+ if (res)
goto err_exit3;
- }
host->dma_buf = devm_kzalloc(&pdev->dev, mtd->writesize, GFP_KERNEL);
if (!host->dma_buf) {
@@ -793,10 +792,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
* Fills out all the uninitialized function pointers with the defaults
* And scans for a bad block table if appropriate.
*/
- if (nand_scan_tail(mtd)) {
- res = -ENXIO;
+ res = nand_scan_tail(mtd);
+ if (res)
goto err_exit4;
- }
mtd->name = DRV_NAME;
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 8d3edc3..f1094e5 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -894,10 +894,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
}
/* Find NAND device */
- if (nand_scan_ident(mtd, 1, NULL)) {
- res = -ENXIO;
+ res = nand_scan_ident(mtd, 1, NULL);
+ if (res)
goto err_exit3;
- }
/* OOB and ECC CPU and DMA work areas */
host->ecc_buf = (uint32_t *)(host->data_buf + LPC32XX_DMA_DATA_SIZE);
@@ -929,10 +928,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
/*
* Fills out all the uninitialized function pointers with the defaults
*/
- if (nand_scan_tail(mtd)) {
- res = -ENXIO;
+ res = nand_scan_tail(mtd);
goto err_exit3;
- }
mtd->name = "nxp_lpc3220_slc";
res = mtd_device_register(mtd, host->ncfg->parts,
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 14/22] mtd: nand: mediatek: return error code of nand_scan_ident/tail() on error
2016-11-04 10:42 [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) on error Masahiro Yamada
2016-11-04 10:43 ` [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() " Masahiro Yamada
@ 2016-11-04 10:43 ` Masahiro Yamada
2016-11-05 7:34 ` [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) " Marek Vasut
2016-11-06 22:55 ` [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident,_tail) " Boris Brezillon
3 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-11-04 10:43 UTC (permalink / raw)
To: linux-arm-kernel
The nand_scan_ident/tail() returns an appropriate error value when
it fails. Use it instead of the fixed error code -ENODEV.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/mtd/nand/mtk_nand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
index 5223a21..6c3eed3 100644
--- a/drivers/mtd/nand/mtk_nand.c
+++ b/drivers/mtd/nand/mtk_nand.c
@@ -1297,7 +1297,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
ret = nand_scan_ident(mtd, nsels, NULL);
if (ret)
- return -ENODEV;
+ return ret;
/* store bbt magic in page, cause OOB is not protected */
if (nand->bbt_options & NAND_BBT_USE_FLASH)
@@ -1323,7 +1323,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
ret = nand_scan_tail(mtd);
if (ret)
- return -ENODEV;
+ return ret;
ret = mtd_device_parse_register(mtd, NULL, NULL, NULL, 0);
if (ret) {
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) on error
2016-11-04 10:42 [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) on error Masahiro Yamada
2016-11-04 10:43 ` [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() " Masahiro Yamada
2016-11-04 10:43 ` [PATCH 14/22] mtd: nand: mediatek: " Masahiro Yamada
@ 2016-11-05 7:34 ` Marek Vasut
2016-11-06 22:55 ` [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident,_tail) " Boris Brezillon
3 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2016-11-05 7:34 UTC (permalink / raw)
To: linux-arm-kernel
On 11/04/2016 11:42 AM, Masahiro Yamada wrote:
>
> nand_scan(), nand_scan_ident(), nand_scan_tail() return
> an appropriate negative value on error.
>
> Most of drivers return the value from them on error,
> but some of them return the fixed error code -ENXIO
> (and a few return -ENODEV).
>
> This series make those drivers return more precise error code.
>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Nice cleanup, thanks!
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() on error
2016-11-04 10:43 ` [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() " Masahiro Yamada
@ 2016-11-06 1:37 ` Vladimir Zapolskiy
2016-11-06 18:27 ` Boris Brezillon
1 sibling, 0 replies; 8+ messages in thread
From: Vladimir Zapolskiy @ 2016-11-06 1:37 UTC (permalink / raw)
To: linux-arm-kernel
On 11/04/2016 12:43 PM, Masahiro Yamada wrote:
> The nand_scan_ident/tail() returns an appropriate error value when
> it fails. Use it instead of the fixed error code -ENXIO.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Thank you for the change.
--
With best wishes,
Vladimir
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() on error
2016-11-04 10:43 ` [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() " Masahiro Yamada
2016-11-06 1:37 ` Vladimir Zapolskiy
@ 2016-11-06 18:27 ` Boris Brezillon
2016-11-07 0:30 ` Vladimir Zapolskiy
1 sibling, 1 reply; 8+ messages in thread
From: Boris Brezillon @ 2016-11-06 18:27 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 4 Nov 2016 19:43:01 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> The nand_scan_ident/tail() returns an appropriate error value when
> it fails. Use it instead of the fixed error code -ENXIO.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> drivers/mtd/nand/lpc32xx_mlc.c | 10 ++++------
> drivers/mtd/nand/lpc32xx_slc.c | 9 +++------
> 2 files changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
> index 8523881..5553a5d 100644
> --- a/drivers/mtd/nand/lpc32xx_mlc.c
> +++ b/drivers/mtd/nand/lpc32xx_mlc.c
> @@ -747,10 +747,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
> * Scan to find existance of the device and
> * Get the type of NAND device SMALL block or LARGE block
> */
> - if (nand_scan_ident(mtd, 1, NULL)) {
> - res = -ENXIO;
> + res = nand_scan_ident(mtd, 1, NULL);
> + if (res)
> goto err_exit3;
> - }
>
> host->dma_buf = devm_kzalloc(&pdev->dev, mtd->writesize, GFP_KERNEL);
> if (!host->dma_buf) {
> @@ -793,10 +792,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
> * Fills out all the uninitialized function pointers with the defaults
> * And scans for a bad block table if appropriate.
> */
> - if (nand_scan_tail(mtd)) {
> - res = -ENXIO;
> + res = nand_scan_tail(mtd);
> + if (res)
> goto err_exit4;
> - }
>
> mtd->name = DRV_NAME;
>
> diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
> index 8d3edc3..f1094e5 100644
> --- a/drivers/mtd/nand/lpc32xx_slc.c
> +++ b/drivers/mtd/nand/lpc32xx_slc.c
> @@ -894,10 +894,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
> }
>
> /* Find NAND device */
> - if (nand_scan_ident(mtd, 1, NULL)) {
> - res = -ENXIO;
> + res = nand_scan_ident(mtd, 1, NULL);
> + if (res)
> goto err_exit3;
> - }
>
> /* OOB and ECC CPU and DMA work areas */
> host->ecc_buf = (uint32_t *)(host->data_buf + LPC32XX_DMA_DATA_SIZE);
> @@ -929,10 +928,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
> /*
> * Fills out all the uninitialized function pointers with the defaults
> */
> - if (nand_scan_tail(mtd)) {
> - res = -ENXIO;
> + res = nand_scan_tail(mtd);
You miss
if (res)
here.
No need to resend, I'll fix it when applying the patches.
> goto err_exit3;
> - }
>
> mtd->name = "nxp_lpc3220_slc";
> res = mtd_device_register(mtd, host->ncfg->parts,
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident,_tail) on error
2016-11-04 10:42 [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) on error Masahiro Yamada
` (2 preceding siblings ...)
2016-11-05 7:34 ` [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) " Marek Vasut
@ 2016-11-06 22:55 ` Boris Brezillon
3 siblings, 0 replies; 8+ messages in thread
From: Boris Brezillon @ 2016-11-06 22:55 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 4 Nov 2016 19:42:48 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> nand_scan(), nand_scan_ident(), nand_scan_tail() return
> an appropriate negative value on error.
>
> Most of drivers return the value from them on error,
> but some of them return the fixed error code -ENXIO
> (and a few return -ENODEV).
>
> This series make those drivers return more precise error code.
Applied and fixed the bug I found in patch 13.
Thanks,
Boris
>
>
> Masahiro Yamada (22):
> mtd: nand: ams-delta: return error code of nand_scan() on error
> mtd: nand: cmx270: return error code of nand_scan() on error
> mtd: nand: cs553x: return error code of nand_scan() on error
> mtd: nand: gpio: return error code of nand_scan() on error
> mtd: nand: mpc5121: return error code of nand_scan() on error
> mtd: nand: tmio: return error code of nand_scan() on error
> mtd: nand: orion: return error code of nand_scan() on error
> mtd: nand: pasemi: return error code of nand_scan() on error
> mtd: nand: plat_nand: return error code of nand_scan() on error
> mtd: nand: atmel: return error code of nand_scan_ident/tail() on error
> mtd: nand: brcmnand: return error code of nand_scan_ident/tail() on
> error
> mtd: nand: fsmc: return error code of nand_scan_ident/tail() on error
> mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() on
> error
> mtd: nand: mediatek: return error code of nand_scan_ident/tail() on
> error
> mtd: nand: mxc: return error code of nand_scan_ident/tail() on error
> mtd: nand: omap2: return error code of nand_scan_ident/tail() on error
> mtd: nand: vf610: return error code of nand_scan_ident/tail() on error
> mtd: nand: cafe: return error code of nand_scan_ident() on error
> mtd: nand: hisi504: return error code of nand_scan_ident() on error
> mtd: nand: pxa3xx: return error code of nand_scan_ident() on error
> mtd: nand: nandsim: remove unneeded checks for nand_scan_ident/tail()
> mtd: nand: socrates: use nand_scan() for nand_scan_ident/tail() combo
>
> drivers/mtd/nand/ams-delta.c | 5 ++---
> drivers/mtd/nand/atmel_nand.c | 10 ++++------
> drivers/mtd/nand/brcmnand/brcmnand.c | 10 ++++++----
> drivers/mtd/nand/cafe_nand.c | 5 ++---
> drivers/mtd/nand/cmx270_nand.c | 4 ++--
> drivers/mtd/nand/cs553x_nand.c | 5 ++---
> drivers/mtd/nand/fsmc_nand.c | 9 ++++-----
> drivers/mtd/nand/gpio.c | 5 ++---
> drivers/mtd/nand/hisi504_nand.c | 4 +---
> drivers/mtd/nand/lpc32xx_mlc.c | 10 ++++------
> drivers/mtd/nand/lpc32xx_slc.c | 9 +++------
> drivers/mtd/nand/mpc5121_nfc.c | 4 ++--
> drivers/mtd/nand/mtk_nand.c | 4 ++--
> drivers/mtd/nand/mxc_nand.c | 10 ++++------
> drivers/mtd/nand/nandsim.c | 4 ----
> drivers/mtd/nand/omap2.c | 9 ++++-----
> drivers/mtd/nand/orion_nand.c | 5 ++---
> drivers/mtd/nand/pasemi_nand.c | 5 ++---
> drivers/mtd/nand/plat_nand.c | 5 ++---
> drivers/mtd/nand/pxa3xx_nand.c | 5 +++--
> drivers/mtd/nand/socrates_nand.c | 12 ++----------
> drivers/mtd/nand/tmio_nand.c | 6 +++---
> drivers/mtd/nand/vf610_nfc.c | 10 ++++------
> 23 files changed, 62 insertions(+), 93 deletions(-)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() on error
2016-11-06 18:27 ` Boris Brezillon
@ 2016-11-07 0:30 ` Vladimir Zapolskiy
0 siblings, 0 replies; 8+ messages in thread
From: Vladimir Zapolskiy @ 2016-11-07 0:30 UTC (permalink / raw)
To: linux-arm-kernel
Hi Boris,
On 11/06/2016 08:27 PM, Boris Brezillon wrote:
> On Fri, 4 Nov 2016 19:43:01 +0900
> Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>
>> The nand_scan_ident/tail() returns an appropriate error value when
>> it fails. Use it instead of the fixed error code -ENXIO.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
[snip]
>> - if (nand_scan_tail(mtd)) {
>> - res = -ENXIO;
>> + res = nand_scan_tail(mtd);
>
> You miss
>
> if (res)
>
> here.
>
> No need to resend, I'll fix it when applying the patches.
>
>> goto err_exit3;
>> - }
>>
nice catch, thank you for noticing and fixing the overlooked bug!
--
With best wishes,
Vladimir
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-11-07 0:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-04 10:42 [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) on error Masahiro Yamada
2016-11-04 10:43 ` [PATCH 13/22] mtd: nand: lpc32xx: return error code of nand_scan_ident/tail() " Masahiro Yamada
2016-11-06 1:37 ` Vladimir Zapolskiy
2016-11-06 18:27 ` Boris Brezillon
2016-11-07 0:30 ` Vladimir Zapolskiy
2016-11-04 10:43 ` [PATCH 14/22] mtd: nand: mediatek: " Masahiro Yamada
2016-11-05 7:34 ` [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident, _tail) " Marek Vasut
2016-11-06 22:55 ` [PATCH 00/22] mtd: nand: return error code of nand_scan(_ident,_tail) " Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox