Skip to contentSkip to conversation

staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type

PATCH In review Sudip Mukherjee 3 participants 8 messages Sep 4, 2014 – Sep 5, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type

fixed sparse warning : incorrect type in argument 1
(different address spaces)

---
 drivers/staging/iio/adc/mxs-lradc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +6 -3
index 468327f..d8d1fe1 100644
@@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 	/* Grab the memory area */
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	lradc->dev = &pdev->dev;
-	lradc->base = devm_ioremap_resource(dev, iores);
-	if (IS_ERR(lradc->base))
-		return PTR_ERR(lradc->base);
+	void *tempptr;
+
+	tempptr = devm_ioremap_resource(dev, iores);
+	if (IS_ERR(tempptr))
+		return PTR_ERR(tempptr);
+	lradc->base = tempptr;
 
 	lradc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(lradc->clk)) {
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 15 lines · Sudip Mukherjee

fixed sparse warning : incorrect type in argument 1
(different address spaces)

---
  drivers/staging/iio/adc/mxs-lradc.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +0 -0
index 468327f..d8d1fe1 100644
@@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev)
  	/* Grab the memory area */
  	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);

drivers/staging/iio/adc/mxs-lradc.c static int mxs_lradc_probe(struct platform_device *pdev) · line 1553

Quoted 10 lines
drivers/staging/iio/adc/mxs-lradc.c +6 -3
  	lradc->dev = &pdev->dev;
-	lradc->base = devm_ioremap_resource(dev, iores);
-	if (IS_ERR(lradc->base))
-		return PTR_ERR(lradc->base);
+	void *tempptr;
+
+	tempptr = devm_ioremap_resource(dev, iores);
+	if (IS_ERR(tempptr))
+		return PTR_ERR(tempptr);
+	lradc->base = tempptr;

This makes no sense at all... devm_ioremap_resource() returns a iomem pointer lrdac->base is a iomem pointer.

Please make sure that you have the latest version of sparse installed on your system.

Quoted 4 lines
drivers/staging/iio/adc/mxs-lradc.c +0 -0
  	lradc->clk = devm_clk_get(&pdev->dev, NULL);
  	if (IS_ERR(lradc->clk)) {
 
#2 lore raw
Quoted 21 lines · Lars-Peter Clausen
Quoted 20 lines · Sudip Mukherjee

fixed sparse warning : incorrect type in argument 1
(different address spaces)

---
 drivers/staging/iio/adc/mxs-lradc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +1 -3
index 468327f..d8d1fe1 100644
@@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 	/* Grab the memory area */
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	lradc->dev = &pdev->dev;
-	lradc->base = devm_ioremap_resource(dev, iores);
-	if (IS_ERR(lradc->base))
-		return PTR_ERR(lradc->base);
+	void *tempptr;
Quoted 8 lines

drivers/staging/iio/adc/mxs-lradc.c static int mxs_lradc_probe(struct platform_device *pdev) · line 1553

Quoted 5 lines
drivers/staging/iio/adc/mxs-lradc.c +5 -0
+
+	tempptr = devm_ioremap_resource(dev, iores);
+	if (IS_ERR(tempptr))
+		return PTR_ERR(tempptr);
+	lradc->base = tempptr;

This makes no sense at all... devm_ioremap_resource() returns a iomem pointer lrdac->base is a iomem pointer.

sparse is giving warning for argument 1 of IS_ERR.

Quoted 9 lines

Please make sure that you have the latest version of sparse installed on your system.

Quoted 4 lines
drivers/staging/iio/adc/mxs-lradc.c +0 -0
 	lradc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(lradc->clk)) {
 

thanks
sudip

#3 lore raw
Quoted 31 lines · Sudip Mukherjee
Quoted 21 lines · Lars-Peter Clausen
Quoted 20 lines · Sudip Mukherjee

fixed sparse warning : incorrect type in argument 1
(different address spaces)

---
  drivers/staging/iio/adc/mxs-lradc.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +1 -3
index 468327f..d8d1fe1 100644
@@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev)
  	/* Grab the memory area */
  	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  	lradc->dev = &pdev->dev;
-	lradc->base = devm_ioremap_resource(dev, iores);
-	if (IS_ERR(lradc->base))
-		return PTR_ERR(lradc->base);
+	void *tempptr;
Quoted 8 lines

drivers/staging/iio/adc/mxs-lradc.c static int mxs_lradc_probe(struct platform_device *pdev) · line 1553

Quoted 5 lines
drivers/staging/iio/adc/mxs-lradc.c +5 -0
+
+	tempptr = devm_ioremap_resource(dev, iores);
+	if (IS_ERR(tempptr))
+		return PTR_ERR(tempptr);
+	lradc->base = tempptr;

This makes no sense at all... devm_ioremap_resource() returns a iomem pointer lrdac->base is a iomem pointer.

Quoted 1 line

sparse is giving warning for argument 1 of IS_ERR.

Not if you update to the latest version of sparse.

Quoted 14 lines
Quoted 10 lines

Please make sure that you have the latest version of sparse installed on your system.

Quoted 4 lines
drivers/staging/iio/adc/mxs-lradc.c +0 -0
  	lradc->clk = devm_clk_get(&pdev->dev, NULL);
  	if (IS_ERR(lradc->clk)) {
 

thanks
sudip

#4 lore raw
Quoted 32 lines · Lars-Peter Clausen
Quoted 31 lines · Sudip Mukherjee
Quoted 29 lines · Lars-Peter Clausen
Quoted 15 lines · Sudip Mukherjee

fixed sparse warning : incorrect type in argument 1
(different address spaces)

---
 drivers/staging/iio/adc/mxs-lradc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +0 -0
index 468327f..d8d1fe1 100644
@@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 	/* Grab the memory area */
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);

drivers/staging/iio/adc/mxs-lradc.c static int mxs_lradc_probe(struct platform_device *pdev) · line 1553

Quoted 10 lines
drivers/staging/iio/adc/mxs-lradc.c +6 -3
 	lradc->dev = &pdev->dev;
-	lradc->base = devm_ioremap_resource(dev, iores);
-	if (IS_ERR(lradc->base))
-		return PTR_ERR(lradc->base);
+	void *tempptr;
+
+	tempptr = devm_ioremap_resource(dev, iores);
+	if (IS_ERR(tempptr))
+		return PTR_ERR(tempptr);
+	lradc->base = tempptr;

This makes no sense at all... devm_ioremap_resource() returns a iomem pointer lrdac->base is a iomem pointer.

Quoted 4 lines
Quoted 1 line

sparse is giving warning for argument 1 of IS_ERR.

Not if you update to the latest version of sparse.

yes , looks like ubuntu repository is having version 0.4.3 , whereas the latest version is 0.5.0. and with this one there no warning for iio. sorry for the noise.

thanks
sudip

Quoted 15 lines
Quoted 14 lines
Quoted 10 lines

Please make sure that you have the latest version of sparse installed on your system.

Quoted 4 lines
drivers/staging/iio/adc/mxs-lradc.c +0 -0
 	lradc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(lradc->clk)) {
 

thanks
sudip

#6 lore raw
In reply to Sudip Mukherjee
Quoted 3 lines · Sudip Mukherjee

fixed sparse warning : incorrect type in argument 1
(different address spaces)

The change log is not clear. It's the IS_ERR() which is the problem? This is a false positive which is fixed in a later version of Sparse.

regards,
dan carpenter

#7 lore raw
Quoted 5 lines · Dan Carpenter
Quoted 3 lines · Sudip Mukherjee

fixed sparse warning : incorrect type in argument 1
(different address spaces)

Quoted 7 lines

The change log is not clear. It's the IS_ERR() which is the problem? This is a false positive which is fixed in a later version of Sparse.

regards,
dan carpenter

yes , problem with sparse. ubuntu repo was not having the latest version ,
and i did not check what is the latest .
sorry for it.

thanks
sudip