Patchwork [RESEND] mtd: denali: fix error handling for devm_ioremap_nocache()

login
register
mail settings
Submitter Xi Wang
Date May 3, 2013, 4:37 a.m.
Message ID <1367555839-12920-1-git-send-email-xi.wang@gmail.com>
Download mbox | patch
Permalink /patch/241146/
State New
Headers show

Comments

Xi Wang - May 3, 2013, 4:37 a.m.
It is incorrect to use `!res' for error handling since `res' must be
non-null.  Use the return value `ptr' instead.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
 drivers/mtd/nand/denali_dt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Artem Bityutskiy - May 29, 2013, 12:42 p.m.
On Fri, 2013-05-03 at 00:37 -0400, Xi Wang wrote:
> It is incorrect to use `!res' for error handling since `res' must be
> non-null.  Use the return value `ptr' instead.
> 
> Signed-off-by: Xi Wang <xi.wang@gmail.com>
> ---

This is already fixed upstream:

commit 6c67050ab108bcce2576fa1d7a0557eb0376520a
Author: Sachin Kamat <sachin.kamat@linaro.org>
Date:   Mon Mar 18 15:11:11 2013 +0530

    mtd: denali_dt: Fix incorrect error check
    
    The return value of devm_ioremap_nocache should be checked here
instead
    of res.
    
    Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Patch

diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c
index 546f8cb..02988b0 100644
--- a/drivers/mtd/nand/denali_dt.c
+++ b/drivers/mtd/nand/denali_dt.c
@@ -42,7 +42,7 @@  static void __iomem *request_and_map(struct device *dev,
 	}
 
 	ptr = devm_ioremap_nocache(dev, res->start, resource_size(res));
-	if (!res)
+	if (!ptr)
 		dev_err(dev, "ioremap_nocache of %s failed!", res->name);
 
 	return ptr;