Skip to contentSkip to conversation

input: touchscreen: mxs-lradc: use correct error check

PATCH Applied Pan Bian 2 participants 2 messages Aug 8, 2017 – Aug 14, 2017

Subsystems (3)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

Function devm_ioremap() will return a NULL pointer on failure. However, in function mxs_lradc_ts_probe(), its return value is checked with IS_ERR(), which cannot detect the exceptional case.

---
 drivers/input/touchscreen/mxs-lradc-ts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/mxs-lradc-ts.c +2 -2
index 58c016c..9bcc98c6 100644
@@ -631,8 +631,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
-	if (IS_ERR(ts->base))
-		return PTR_ERR(ts->base);
+	if (!ts->base)
+		return -ENOMEM;
 
 	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
 				   &ts_wires);
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Pan Bian

Function devm_ioremap() will return a NULL pointer on failure. However, in function mxs_lradc_ts_probe(), its return value is checked with IS_ERR(), which cannot detect the exceptional case.

Applied, thank you.

Quoted 23 lines
---
 drivers/input/touchscreen/mxs-lradc-ts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/mxs-lradc-ts.c +2 -2
index 58c016c..9bcc98c6 100644
@@ -631,8 +631,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
-	if (IS_ERR(ts->base))
-		return PTR_ERR(ts->base);
+	if (!ts->base)
+		return -ENOMEM;
 
 	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
 				   &ts_wires);
Signature · 1 line
1.9.1
Signature · 1 line
Dmitry