summaryrefslogtreecommitdiff
path: root/drivers/input/sparse-keymap.c
diff options
context:
space:
mode:
authorRaag Jadav <raag.jadav@intel.com>2025-02-12 11:55:12 +0530
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2025-02-24 12:08:52 +0200
commitcdcc09a495a4fa60f1c612db207d78b82b6c4531 (patch)
treedfcbcee04d786b96063dbe7a173c1f03c81f0264 /drivers/input/sparse-keymap.c
parenta0d78eec88395e67117a3453f55a4fc3c7265cf2 (diff)
input: sparse-keymap: use devm_kmemdup_array()
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>
Diffstat (limited to 'drivers/input/sparse-keymap.c')
-rw-r--r--drivers/input/sparse-keymap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index 25bf8be6e711..96f23ae57d5a 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -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;