[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230419-dynamic-vmon-v4-1-4d3734e62ada@skidata.com>
Date: Tue, 20 Jun 2023 22:02:54 +0200
From: Benjamin Bara <bbara93@...il.com>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>
Cc: support.opensource@...semi.com,
DLG-Adam.Ward.opensource@...renesas.com,
Martin Fuzzey <martin.fuzzey@...wbird.group>,
linux-kernel@...r.kernel.org,
Matti Vaittinen <mazziesaccount@...il.com>,
Benjamin Bara <benjamin.bara@...data.com>
Subject: [PATCH RFC v4 01/13] regulator: da9063: fix null pointer deref
with partial DT config
From: Benjamin Bara <benjamin.bara@...data.com>
Skip checking the XVP constraints if the regulator has no DT node.
This fixes a null pointer dereference.
Fixes: b8717a80e6ee ("regulator: da9063: implement setter for voltage monitoring")
Reported-by: Martin Fuzzey <martin.fuzzey@...wbird.group>
Closes: https://lore.kernel.org/all/20230616143736.2946173-1-martin.fuzzey@flowbird.group/
Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>
---
drivers/regulator/da9063-regulator.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index c5dd77be558b..308ad63fcf78 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -1028,9 +1028,12 @@ static int da9063_regulator_probe(struct platform_device *pdev)
config.of_node = da9063_reg_matches[id].of_node;
config.regmap = da9063->regmap;
- ret = da9063_check_xvp_constraints(&config);
- if (ret)
- return ret;
+ /* Only check constraints if DT node is available. */
+ if (config.init_data) {
+ ret = da9063_check_xvp_constraints(&config);
+ if (ret)
+ return ret;
+ }
regl->rdev = devm_regulator_register(&pdev->dev, ®l->desc,
&config);
--
2.34.1
Powered by blists - more mailing lists