From: Sachin Kamat Date: Mon, 29 Jul 2013 08:19:32 +0000 (+0530) Subject: pinctrl: sunxi: Fix incorrect NULL check X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3efa921d5b50c045259f6556262fed77dfecec86;p=linux-beck.git pinctrl: sunxi: Fix incorrect NULL check *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 Acked-by: Maxime Ripard Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index c47fd1e5450b..3655a5a85ac0 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c @@ -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) {