]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
input: sparse-keymap: use devm_kmemdup_array()
authorRaag Jadav <raag.jadav@intel.com>
Wed, 12 Feb 2025 06:25:12 +0000 (11:55 +0530)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 24 Feb 2025 10:08:52 +0000 (12:08 +0200)
Convert to use devm_kmemdup_array() and while at it, use source size
instead of destination.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/input/sparse-keymap.c

index 25bf8be6e71116b6e6cce6503222f0769fcfd14c..96f23ae57d5aebb7eb7ca441b1272aa9e27e4a74 100644 (file)
@@ -176,8 +176,7 @@ int sparse_keymap_setup(struct input_dev *dev,
        for (e = keymap; e->type != KE_END; e++)
                map_size++;
 
-       map = devm_kmemdup(&dev->dev, keymap, map_size * sizeof(*map),
-                          GFP_KERNEL);
+       map = devm_kmemdup_array(&dev->dev, keymap, map_size, sizeof(*keymap), GFP_KERNEL);
        if (!map)
                return -ENOMEM;