diff options
| author | Mark Brown <broonie@kernel.org> | 2025-02-28 16:33:32 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-02-28 16:33:32 +0000 |
| commit | 1455f0badd6345b2606bafb32e719d252293ebcd (patch) | |
| tree | 723dd03cd15efa9098877edef887fdc511f51a7d /drivers/regulator | |
| parent | b80fd34df2580f2c7a99e7188d68515bcf779714 (diff) | |
| parent | c5c4ce6612bb25ce6d6936d8ade96fcba635da54 (diff) | |
Convert regulator drivers to use
Merge series from Raag Jadav <raag.jadav@intel.com>:
This series converts regulator drivers to use the newly introduced[1]
devm_kmemdup_array() helper.
[1] https://lore.kernel.org/r/20250212062513.2254767-1-raag.jadav@intel.com
Diffstat (limited to 'drivers/regulator')
| -rw-r--r-- | drivers/regulator/cros-ec-regulator.c | 4 | ||||
| -rw-r--r-- | drivers/regulator/devres.c | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/drivers/regulator/cros-ec-regulator.c b/drivers/regulator/cros-ec-regulator.c index fb9643ed7a49..fb0767b33a36 100644 --- a/drivers/regulator/cros-ec-regulator.c +++ b/drivers/regulator/cros-ec-regulator.c @@ -138,8 +138,8 @@ static int cros_ec_regulator_init_info(struct device *dev, data->num_voltages = min_t(u16, ARRAY_SIZE(resp.voltages_mv), resp.num_voltages); data->voltages_mV = - devm_kmemdup(dev, resp.voltages_mv, - sizeof(u16) * data->num_voltages, GFP_KERNEL); + devm_kmemdup_array(dev, resp.voltages_mv, data->num_voltages, + sizeof(resp.voltages_mv[0]), GFP_KERNEL); if (!data->voltages_mV) return -ENOMEM; diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c index a3a3ccc711fc..2cf03042fddf 100644 --- a/drivers/regulator/devres.c +++ b/drivers/regulator/devres.c @@ -332,9 +332,8 @@ int devm_regulator_bulk_get_const(struct device *dev, int num_consumers, const struct regulator_bulk_data *in_consumers, struct regulator_bulk_data **out_consumers) { - *out_consumers = devm_kmemdup(dev, in_consumers, - num_consumers * sizeof(*in_consumers), - GFP_KERNEL); + *out_consumers = devm_kmemdup_array(dev, in_consumers, num_consumers, + sizeof(*in_consumers), GFP_KERNEL); if (*out_consumers == NULL) return -ENOMEM; |
