gpio: brcmstb: Handle return value of devm_kasprintf
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Thu, 21 Sep 2017 05:14:13 +0000 (10:44 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 21 Sep 2017 12:13:16 +0000 (14:13 +0200)
devm_kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-brcmstb.c

index dd0308cc8bb0be09ad015a88521a1f2bfd409132..27e92e57adae0633d7cc90114d7d00169cd4f6d0 100644 (file)
@@ -485,6 +485,10 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
                gc->of_node = np;
                gc->owner = THIS_MODULE;
                gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", dev->of_node);
+               if (!gc->label) {
+                       err = -ENOMEM;
+                       goto fail;
+               }
                gc->base = gpio_base;
                gc->of_gpio_n_cells = 2;
                gc->of_xlate = brcmstb_gpio_of_xlate;