Skip to content

Commit 98e2dd5

Browse files
Martin Fuzzeybroonie
authored andcommitted
regulator: da9063: fix null pointer deref with partial DT config
When some of the da9063 regulators do not have corresponding DT nodes a null pointer dereference occurs on boot because such regulators have no init_data causing the pointers calculated in da9063_check_xvp_constraints() to be invalid. Do not dereference them in this case. Fixes: b8717a8 ("regulator: da9063: implement setter for voltage monitoring") Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group> Link: https://lore.kernel.org/r/20230616143736.2946173-1-martin.fuzzey@flowbird.group Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent fdf0eaf commit 98e2dd5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/regulator/da9063-regulator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,9 @@ static int da9063_check_xvp_constraints(struct regulator_config *config)
778778
const struct notification_limit *uv_l = &constr->under_voltage_limits;
779779
const struct notification_limit *ov_l = &constr->over_voltage_limits;
780780

781+
if (!config->init_data) /* No config in DT, pointers will be invalid */
782+
return 0;
783+
781784
/* make sure that only one severity is used to clarify if unchanged, enabled or disabled */
782785
if ((!!uv_l->prot + !!uv_l->err + !!uv_l->warn) > 1) {
783786
dev_err(config->dev, "%s: at most one voltage monitoring severity allowed!\n",

0 commit comments

Comments
 (0)