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: cpcap-pwrbutton - handle errors from platform_get_irq()

The function cpcap_power_button_probe() does not perform
sufficient error checking after executing platform_get_irq(),
thus fix it.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20210802121740.8700-1-tangbin@cmss.chinamobile.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Tang Bin and committed by
Dmitry Torokhov
58ae4004 3e204d6b

+5 -1
+5 -1
drivers/input/misc/cpcap-pwrbutton.c
··· 54 54 static int cpcap_power_button_probe(struct platform_device *pdev) 55 55 { 56 56 struct cpcap_power_button *button; 57 - int irq = platform_get_irq(pdev, 0); 57 + int irq; 58 58 int err; 59 + 60 + irq = platform_get_irq(pdev, 0); 61 + if (irq < 0) 62 + return irq; 59 63 60 64 button = devm_kmalloc(&pdev->dev, sizeof(*button), GFP_KERNEL); 61 65 if (!button)