Skip to content

Commit

Permalink
regulator: Check ramp_delay_table for regulator_set_ramp_delay_regmap
Browse files Browse the repository at this point in the history
Return -EINVAL if ramp_delay_table is NULL.
Also add WARN_ON since the driver code needs fix if this happened.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210519132255.1683863-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed May 19, 2021
1 parent 34991ee commit 687c9e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ int regulator_set_ramp_delay_regmap(struct regulator_dev *rdev, int ramp_delay)
int ret;
unsigned int sel;

if (!rdev->desc->n_ramp_values)
if (WARN_ON(!rdev->desc->n_ramp_values || !rdev->desc->ramp_delay_table))
return -EINVAL;

ret = find_closest_bigger(ramp_delay, rdev->desc->ramp_delay_table,
Expand Down

0 comments on commit 687c9e3

Please sign in to comment.