From: Dong Aisheng Date: Wed, 12 Apr 2017 01:58:42 +0000 (+0800) Subject: regulator: anatop: check return value of of_get_regulator_init_data X-Git-Tag: v4.12-rc1~111^2~3^2~5 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=7f51cf2ea7186e3f217e616a5522f1156678356f;hp=d00b74613fb18dfd0a5aa99270ee2e72d5c808d7;p=linux-2.6-block.git regulator: anatop: check return value of of_get_regulator_init_data Should check the return value of of_get_regulator_init_data before using it. Signed-off-by: Dong Aisheng Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 3a6d0290c54c..aa93f462ac6e 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -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;