[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230509094942.396150-3-james.clark@arm.com>
Date: Tue, 9 May 2023 10:49:39 +0100
From: James Clark <james.clark@....com>
To: linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org
Cc: linux@...ck-us.net, michal.simek@....com,
Jonathan.Cameron@...wei.com, James Clark <james.clark@....com>,
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>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.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: [PATCH v4 2/4] hwmon: pmbus: Use devm_krealloc_array
Now that it exists, use it instead of doing the multiplication manually.
Acked-by: Guenter Roeck <linux@...ck-us.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Signed-off-by: James Clark <james.clark@....com>
---
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 9d14954da94f..fa06325f5a7c 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;
--
2.34.1
Powered by blists - more mailing lists