]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
clk: bcm2835: fix check of error code returned by devm_ioremap_resource()
authorVladimir Zapolskiy <vz@mleia.com>
Sun, 6 Mar 2016 01:21:35 +0000 (03:21 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Wed, 16 Mar 2016 01:14:11 +0000 (18:14 -0700)
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: 5e63dcc74b30 ("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>
drivers/clk/bcm/clk-bcm2835-aux.c

index e4f89e28b5ecf5a88bbbdc50111904beb470b2a6..3a177ade6e6cc71d84337504df37543227bcb74f 100644 (file)
@@ -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)