From: James Clark Date: Tue, 9 May 2023 09:49:39 +0000 (+0100) Subject: hwmon: pmbus: Use devm_krealloc_array X-Git-Tag: v6.6.17~4468^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5f7548445b6adc48c9076073a6f20b8806e9a87;p=platform%2Fkernel%2Flinux-rpi.git hwmon: pmbus: Use devm_krealloc_array Now that it exists, use it instead of doing the multiplication manually. Acked-by: Guenter Roeck Reviewed-by: Jonathan Cameron Signed-off-by: James Clark Link: https://lore.kernel.org/r/20230509094942.396150-3-james.clark@arm.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 9d14954..fa06325 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1191,9 +1191,9 @@ static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) { if (data->num_attributes >= data->max_attributes - 1) { int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE; - void *new_attrs = devm_krealloc(data->dev, data->group.attrs, - new_max_attrs * sizeof(void *), - GFP_KERNEL); + void *new_attrs = devm_krealloc_array(data->dev, data->group.attrs, + new_max_attrs, sizeof(void *), + GFP_KERNEL); if (!new_attrs) return -ENOMEM; data->group.attrs = new_attrs;