提交 4d3ac666 编写于 作者: V Vladimir Zapolskiy 提交者: Stephen Boyd

clk: bcm2835: fix check of error code returned by devm_ioremap_resource()

The change fixes potential oops while accessing iomem on invalid
address, if devm_ioremap_resource() fails due to some reason.

The devm_ioremap_resource() function returns ERR_PTR() and never
returns NULL, which makes useless a following check for NULL.
Signed-off-by: NVladimir Zapolskiy <vz@mleia.com>
Fixes: 5e63dcc7 ("clk: bcm2835: Add a driver for the auxiliary peripheral clock gates")
Reviewed-by: NEric Anholt <eric@anholt.net>
Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
上级 e8087b5b
......@@ -38,8 +38,8 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
reg = devm_ioremap_resource(dev, res);
if (!reg)
return -ENODEV;
if (IS_ERR(reg))
return PTR_ERR(reg);
onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL);
if (!onecell)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册