[PATCH v3 05/20] pinctrl: baytrail: copy communities using devm_kmemdup_array()

Raag Jadav
2025-02-03T08:09:26Z

Copy communities using devm_kmemdup_array() instead of doing it manually.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
drivers/pinctrl/intel/pinctrl-baytrail.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 7340dc20349c..797315fee29a 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1557,16 +1557,14 @@ static int byt_set_soc_data(struct intel_pinctrl *vg,
vg->soc = soc;

vg->ncommunities = vg->soc->ncommunities;
- vg->communities = devm_kcalloc(vg->dev, vg->ncommunities,
- sizeof(*vg->communities), GFP_KERNEL);
+ vg->communities = devm_kmemdup_array(vg->dev, vg->soc->communities, vg->ncommunities,
+ sizeof(*vg->communities), GFP_KERNEL);
if (!vg->communities)
return -ENOMEM;

for (i = 0; i < vg->soc->ncommunities; i++) {
struct intel_community *comm = vg->communities + i;

- *comm = vg->soc->communities[i];
-
comm->pad_regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(comm->pad_regs))
return PTR_ERR(comm->pad_regs);
--
2.34.1