Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: samsung-keypad - do not combine memory allocation checks

The driver uses devm API to allocate resources so there's no reason
to do allocations first and then check and release everything at once.

Check results immediately after doing allocation of each resource.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240819045813.2154642-4-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+4 -1
+4 -1
drivers/input/keyboard/samsung-keypad.c
··· 349 349 350 350 keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad) + keymap_size, 351 351 GFP_KERNEL); 352 + if (!keypad) 353 + return -ENOMEM; 354 + 352 355 input_dev = devm_input_allocate_device(&pdev->dev); 353 - if (!keypad || !input_dev) 356 + if (!input_dev) 354 357 return -ENOMEM; 355 358 356 359 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);