Skip to content

Commit c5f7548

Browse files
James-A-Clarkgregkh
authored andcommitted
hwmon: pmbus: Use devm_krealloc_array
Now that it exists, use it instead of doing the multiplication manually. Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: James Clark <james.clark@arm.com> Link: https://lore.kernel.org/r/20230509094942.396150-3-james.clark@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d388f06 commit c5f7548

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/hwmon/pmbus/pmbus_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,9 +1191,9 @@ static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr)
11911191
{
11921192
if (data->num_attributes >= data->max_attributes - 1) {
11931193
int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE;
1194-
void *new_attrs = devm_krealloc(data->dev, data->group.attrs,
1195-
new_max_attrs * sizeof(void *),
1196-
GFP_KERNEL);
1194+
void *new_attrs = devm_krealloc_array(data->dev, data->group.attrs,
1195+
new_max_attrs, sizeof(void *),
1196+
GFP_KERNEL);
11971197
if (!new_attrs)
11981198
return -ENOMEM;
11991199
data->group.attrs = new_attrs;

0 commit comments

Comments
 (0)