Skip to content

Commit

Permalink
clk: bcm2835: fix check of error code returned by devm_ioremap_resour…
Browse files Browse the repository at this point in the history
…ce()

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: Vladimir Zapolskiy <vz@mleia.com>
Fixes: 5e63dcc ("clk: bcm2835: Add a driver for the auxiliary peripheral clock gates")
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
  • Loading branch information
Vladimir Zapolskiy authored and Stephen Boyd committed Mar 16, 2016
1 parent e8087b5 commit 4d3ac66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/clk/bcm/clk-bcm2835-aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4d3ac66

Please sign in to comment.