]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: pinconf-generic: Use kmemdup_array() over kmemdup()
authorYash Suthar <yashsuthar983@gmail.com>
Sat, 18 Apr 2026 19:11:24 +0000 (00:41 +0530)
committerLinus Walleij <linusw@kernel.org>
Tue, 28 Apr 2026 09:31:28 +0000 (11:31 +0200)
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>
Signed-off-by: Linus Walleij <linusw@kernel.org>
drivers/pinctrl/pinconf-generic.c

index 64ed2830978871b5084e60c56271de180e3ed431..d333ddd442987b91806cd42029826fb7153d8dfb 100644 (file)
@@ -419,7 +419,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;