Skip to content

Commit de98a43

Browse files
r-vigneshLee Jones
authored andcommitted
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 <[email protected]> Signed-off-by: Vignesh Raghavendra <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent cfca8bb commit de98a43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mfd/ti_am335x_tscadc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,11 @@ static int ti_tscadc_probe(struct platform_device *pdev)
182182
tscadc->irq = err;
183183

184184
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
185-
tscadc->tscadc_phys_base = res->start;
186185
tscadc->tscadc_base = devm_ioremap_resource(&pdev->dev, res);
187186
if (IS_ERR(tscadc->tscadc_base))
188187
return PTR_ERR(tscadc->tscadc_base);
189188

189+
tscadc->tscadc_phys_base = res->start;
190190
tscadc->regmap = devm_regmap_init_mmio(&pdev->dev,
191191
tscadc->tscadc_base, &tscadc_regmap_config);
192192
if (IS_ERR(tscadc->regmap)) {

0 commit comments

Comments
 (0)