Skip to content

Commit c5c4ce6

Browse files
raagjadavbroonie
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6ddd115 commit c5c4ce6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/regulator/cros-ec-regulator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ static int cros_ec_regulator_init_info(struct device *dev,
138138
data->num_voltages =
139139
min_t(u16, ARRAY_SIZE(resp.voltages_mv), resp.num_voltages);
140140
data->voltages_mV =
141-
devm_kmemdup(dev, resp.voltages_mv,
142-
sizeof(u16) * data->num_voltages, GFP_KERNEL);
141+
devm_kmemdup_array(dev, resp.voltages_mv, data->num_voltages,
142+
sizeof(resp.voltages_mv[0]), GFP_KERNEL);
143143
if (!data->voltages_mV)
144144
return -ENOMEM;
145145

0 commit comments

Comments
 (0)