Patchwork mtd: fsmc_nand: fix error return code in fsmc_nand_probe()

login
register
mail settings
Submitter Wei Yongjun
Date May 13, 2013, 6:55 a.m.
Message ID <CAPgLHd_ETnhT-YQgyPKJJ5meTF_mibYipShRO2GPGMhpdGOuyw@mail.gmail.com>
Download mbox | patch
Permalink /patch/243305/
State New
Headers show

Comments

Wei Yongjun - May 13, 2013, 6:55 a.m.
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix to return -ENODEV in the dma channel request error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/mtd/nand/fsmc_nand.c | 1 +
 1 file changed, 1 insertion(+)
viresh kumar - May 13, 2013, 7:58 a.m.
On 13 May 2013 12:25, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Fix to return -ENODEV in the dma channel request error handling
> case instead of 0, as done elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/mtd/nand/fsmc_nand.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
> index 911e243..6988fc8 100644
> --- a/drivers/mtd/nand/fsmc_nand.c
> +++ b/drivers/mtd/nand/fsmc_nand.c
> @@ -1032,6 +1032,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
>         case USE_DMA_ACCESS:
>                 dma_cap_zero(mask);
>                 dma_cap_set(DMA_MEMCPY, mask);
> +               ret = -ENODEV;
>                 host->read_dma_chan = dma_request_channel(mask, filter,
>                                 pdata->read_dma_priv);
>                 if (!host->read_dma_chan) {
>

Better do it for error cases only.. like:

>                 if (!host->read_dma_chan) {
                           ret = -ENODEV;

Patch

diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 911e243..6988fc8 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -1032,6 +1032,7 @@  static int __init fsmc_nand_probe(struct platform_device *pdev)
 	case USE_DMA_ACCESS:
 		dma_cap_zero(mask);
 		dma_cap_set(DMA_MEMCPY, mask);
+		ret = -ENODEV;
 		host->read_dma_chan = dma_request_channel(mask, filter,
 				pdata->read_dma_priv);
 		if (!host->read_dma_chan) {