Skip to content

Commit c8a3b9b

Browse files
committed
soc: aspeed: lpc-ctrl: Fix probe error handling
gcc warns that a mising "flash" phandle node leads to undefined behavior later: drivers/soc/aspeed/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_probe': drivers/soc/aspeed/aspeed-lpc-ctrl.c:201:18: error: '*((void *)&resm+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized] Only set the flash base and size if we find a phandle in the device tree. Reported-by: Arnd Bergmann <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Reviewed-by: Vijay Khemka <[email protected]> Signed-off-by: Joel Stanley <[email protected]>
1 parent e4272af commit c8a3b9b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/soc/aspeed/aspeed-lpc-ctrl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,11 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
223223
dev_err(dev, "Couldn't address to resource for flash\n");
224224
return rc;
225225
}
226+
227+
lpc_ctrl->pnor_size = resource_size(&resm);
228+
lpc_ctrl->pnor_base = resm.start;
226229
}
227230

228-
lpc_ctrl->pnor_size = resource_size(&resm);
229-
lpc_ctrl->pnor_base = resm.start;
230231

231232
dev_set_drvdata(&pdev->dev, lpc_ctrl);
232233

0 commit comments

Comments
 (0)