Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Reported-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Vignesh Raghavendra and committed by
Lee Jones
de98a43e cfca8bb2

+1 -1
+1 -1
drivers/mfd/ti_am335x_tscadc.c
··· 182 182 tscadc->irq = err; 183 183 184 184 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 185 - tscadc->tscadc_phys_base = res->start; 186 185 tscadc->tscadc_base = devm_ioremap_resource(&pdev->dev, res); 187 186 if (IS_ERR(tscadc->tscadc_base)) 188 187 return PTR_ERR(tscadc->tscadc_base); 189 188 189 + tscadc->tscadc_phys_base = res->start; 190 190 tscadc->regmap = devm_regmap_init_mmio(&pdev->dev, 191 191 tscadc->tscadc_base, &tscadc_regmap_config); 192 192 if (IS_ERR(tscadc->regmap)) {