[PATCH v1 08/13] power: supply: sc27xx: use devm_kmemdup_array()

Raag Jadav
2025-02-21T16:54:22Z

Convert to use devm_kmemdup_array() which is more robust.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
drivers/power/supply/sc27xx_fuel_gauge.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
index f36edc2ba708..573838ca8ed8 100644
--- a/drivers/power/supply/sc27xx_fuel_gauge.c
+++ b/drivers/power/supply/sc27xx_fuel_gauge.c
@@ -1014,9 +1014,8 @@ static int sc27xx_fgu_hw_init(struct sc27xx_fgu_data *data)
if (!table)
return -EINVAL;

- data->cap_table = devm_kmemdup(data->dev, table,
- data->table_len * sizeof(*table),
- GFP_KERNEL);
+ data->cap_table = devm_kmemdup_array(data->dev, table, data->table_len,
+ sizeof(*table), GFP_KERNEL);
if (!data->cap_table) {
power_supply_put_battery_info(data->battery, info);
return -ENOMEM;
--
2.34.1