[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <41828531-0115-2097-4c73-5cf431cb5686@roeck-us.net>
Date: Mon, 6 Mar 2023 07:30:19 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: James Clark <james.clark@....com>, linux-kernel@...r.kernel.org
Cc: Jonathan Corbet <corbet@....net>, Jean Delvare <jdelvare@...e.com>,
Anand Ashok Dumbre <anand.ashok.dumbre@...inx.com>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Michal Simek <michal.simek@...inx.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>, linux-doc@...r.kernel.org,
linux-hwmon@...r.kernel.org, linux-iio@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, linux-serial@...r.kernel.org
Subject: Re: [PATCH 2/4] hwmon: pmbus: Use devm_krealloc_array
On 3/6/23 07:27, James Clark wrote:
> Now that it exists, use it instead of doing the multiplication manually.
>
> Signed-off-by: James Clark <james.clark@....com>
Acked-by: Guenter Roeck <linux@...ck-us.net>
> ---
> drivers/hwmon/pmbus/pmbus_core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 95e95783972a..e7bee25a3706 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -1190,9 +1190,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;
Powered by blists - more mailing lists