Skip to contentSkip to conversation

mtd: denali: fix error handling for devm_ioremap_nocache()

PATCH RESEND In review Xi Wang 2 participants 2 messages May 3, 2013 – May 29, 2013

Subsystems (2)
lore
Share & tools
lore

Xi Wang

author
#0 lore raw

PATCH RESEND 1/1 mtd: denali: fix error handling for devm_ioremap_nocache()

It is incorrect to use !res' for error handling since res' must be non-null. Use the return value `ptr' instead.

---
 drivers/mtd/nand/denali_dt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/denali_dt.c +1 -1
index 546f8cb..02988b0 100644
@@ -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;
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 5 lines · Xi Wang

It is incorrect to use !res' for error handling since res' must be non-null. Use the return value `ptr' instead.

---

This is already fixed upstream:

commit 6c67050ab108bcce2576fa1d7a0557eb0376520a

Author: Sachin Kamat <[email protected]>
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.

Signature · 2 lines
Best Regards,
Artem Bityutskiy