MLK-11909-2 regulator: anatop-regulator: Dereference null return value (NULL_RETURNS)
authorRobin Gong <b38343@freescale.com>
Thu, 26 Nov 2015 09:05:07 +0000 (17:05 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:44 +0000 (14:49 -0500)
Dereference null return value (NULL_RETURNS).

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit e5d41f4bbded2f2b948a13d4dc04596cd896b072)

drivers/regulator/anatop-regulator.c

index be3b350..f761a93 100644 (file)
@@ -242,6 +242,12 @@ static int anatop_regulator_probe(struct platform_device *pdev)
        if (!sreg)
                return -ENOMEM;
        sreg->name = of_get_property(np, "regulator-name", NULL);
+
+       if (!sreg->name) {
+               dev_err(dev, "no regulator-name set\n");
+               return -EINVAL;
+       }
+
        rdesc = &sreg->rdesc;
        rdesc->name = sreg->name;
        rdesc->type = REGULATOR_VOLTAGE;