mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
regulator: cros-ec: use devm_kmemdup_array()
Convert to use devm_kmemdup_array() and while at it, make the size robust against type changes. Signed-off-by: Raag Jadav <raag.jadav@intel.com> Link: https://patch.msgid.link/20250228072057.151436-3-raag.jadav@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
6ddd115982
commit
c5c4ce6612
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue