[PATCH] pinctrl: pinconf-generic: Use kmemdup_array() over kmemdup()

Yash Suthar posted 1 patch 1 month, 4 weeks ago
drivers/pinctrl/pinconf-generic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] pinctrl: pinconf-generic: Use kmemdup_array() over kmemdup()
Posted by Yash Suthar 1 month, 4 weeks ago
using kmemdup_array instead of kmemdup ,as it is more
readable and matches the intent of the api.
tested with w=1, no new warnings introduced.

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
---
 drivers/pinctrl/pinconf-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 2b030bd0e6ad..b5c1587bf2e6 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -371,7 +371,7 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
 	 * Now limit the number of configs to the real number of
 	 * found properties.
 	 */
-	*configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL);
+	*configs = kmemdup_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL);
 	if (!*configs) {
 		ret = -ENOMEM;
 		goto out;
-- 
2.43.0
Re: [PATCH] pinctrl: pinconf-generic: Use kmemdup_array() over kmemdup()
Posted by Linus Walleij 1 month, 2 weeks ago
On Sat, Apr 18, 2026 at 9:11 PM Yash Suthar <yashsuthar983@gmail.com> wrote:

> using kmemdup_array instead of kmemdup ,as it is more
> readable and matches the intent of the api.
> tested with w=1, no new warnings introduced.
>
> Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

Patch applied!

Yours,
Linus Walleij