diff options
author | Axel Lin <axel.lin@ingics.com> | 2021-05-19 16:22:55 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-05-19 16:31:43 +0300 |
commit | 687c9e3b1a81d43b233482f781bd4e20561bc390 (patch) | |
tree | e0c1dd680ab6b614f0d0fccbf968fdf1d90912d5 | |
parent | 34991ee96fd8477479dd15adadceb6b28b30d9b0 (diff) | |
download | linux-687c9e3b1a81d43b233482f781bd4e20561bc390.tar.xz |
regulator: Check ramp_delay_table for regulator_set_ramp_delay_regmap
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>
-rw-r--r-- | drivers/regulator/helpers.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c index 0e16e31c968f..ad2237a95572 100644 --- a/drivers/regulator/helpers.c +++ b/drivers/regulator/helpers.c @@ -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, |