]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pinctrl: sunxi: Fix incorrect NULL check
authorSachin Kamat <sachin.kamat@linaro.org>
Mon, 29 Jul 2013 08:19:32 +0000 (13:49 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 7 Aug 2013 20:29:39 +0000 (22:29 +0200)
*map should be tested for NULL instead of map as kmalloc pointer
is assigned to it. This also fixes a potential null pointer dereference
bug later in the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-sunxi.c

index c47fd1e5450ba6f26ba8e70f2ad207efc1959a82..3655a5a85ac06d6f9c79cf48c5a6e58725841cd1 100644 (file)
@@ -175,7 +175,7 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
        }
 
        *map = kmalloc(nmaps * sizeof(struct pinctrl_map), GFP_KERNEL);
-       if (!map)
+       if (!*map)
                return -ENOMEM;
 
        of_property_for_each_string(node, "allwinner,pins", prop, group) {