[PATCH 1/6] regulator: anatop: check return value of of_get_regulator_init_data
Dong Aisheng
aisheng.dong at nxp.com
Tue Apr 11 21:58:42 EDT 2017
Should check the return value of of_get_regulator_init_data before
using it.
Cc: Liam Girdwood <lgirdwood at gmail.com>
Cc: Mark Brown <broonie at kernel.org>
Cc: Shawn Guo <shawnguo at kernel.org>
Cc: Sascha Hauer <kernel at pengutronix.de>
Cc: Robin Gong <yibin.gong at nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong at nxp.com>
---
drivers/regulator/anatop-regulator.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index b041f27..46b9c2c 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;
--
2.7.4
More information about the linux-arm-kernel
mailing list