regulator: anatop: check return value of of_get_regulator_init_data
authorDong Aisheng <aisheng.dong@nxp.com>
Wed, 12 Apr 2017 01:58:42 +0000 (09:58 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 11 Apr 2017 20:35:54 +0000 (21:35 +0100)
Should check the return value of of_get_regulator_init_data before
using it.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/anatop-regulator.c

index 3a6d0290c54c0fbd0f1c82ffcd5329c2facc56ae..aa93f462ac6eadae9f612472370c5c89e26a0eab 100644 (file)
@@ -200,6 +200,9 @@ static int anatop_regulator_probe(struct platform_device *pdev)
        rdesc->owner = THIS_MODULE;
 
        initdata = of_get_regulator_init_data(dev, np, rdesc);
+       if (!initdata)
+               return -ENOMEM;
+
        initdata->supply_regulator = "vin";
        sreg->initdata = initdata;