Skip to contentSkip to conversation

mfd: ti_am335x_tscadc: Fix static checker warning

PATCH Applied Vignesh Raghavendra 2 participants 2 messages Nov 9, 2019 – Nov 11, 2019 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: ti_am335x_tscadc: Fix static checker warning

It is possible that platform_get_resource() might return NULL and therefore code needs to check for this condition before de-referencing the pointer.
Therefore move the de-referencing of 'res' pointer after devm_ioremap_resource() which would have checked the validity of the pointer

---
 drivers/mfd/ti_am335x_tscadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/ti_am335x_tscadc.c +1 -1
index fd111296b959..926c289cb040 100644
@@ -182,11 +182,11 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 		tscadc->irq = err;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tscadc->tscadc_phys_base = res->start;
 	tscadc->tscadc_base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(tscadc->tscadc_base))
 		return PTR_ERR(tscadc->tscadc_base);
 
+	tscadc->tscadc_phys_base = res->start;
 	tscadc->regmap = devm_regmap_init_mmio(&pdev->dev,
 			tscadc->tscadc_base, &tscadc_regmap_config);
 	if (IS_ERR(tscadc->regmap)) {
Signature · 1 line
2.24.0
Applied
#1 lore raw
Quoted 7 lines · Vignesh Raghavendra

It is possible that platform_get_resource() might return NULL and therefore code needs to check for this condition before de-referencing the pointer.
Therefore move the de-referencing of 'res' pointer after devm_ioremap_resource() which would have checked the validity of the pointer

Quoted 5 lines
---
 drivers/mfd/ti_am335x_tscadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog