]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Input: palmas-pwrbutton - handle return value of platform_get_irq()
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Fri, 17 Nov 2017 20:31:11 +0000 (12:31 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 6 Sep 2021 02:48:07 +0000 (19:48 -0700)
platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/palmas-pwrbutton.c

index 1e1baed63929084f96fe79f47f7b0d8c440960e9..f9b05cf09ff53a7e0187c75a1855f66bf4c6f5bc 100644 (file)
@@ -210,6 +210,11 @@ static int palmas_pwron_probe(struct platform_device *pdev)
        INIT_DELAYED_WORK(&pwron->input_work, palmas_power_button_work);
 
        pwron->irq = platform_get_irq(pdev, 0);
+       if (pwron->irq < 0) {
+               error = pwron->irq;
+               goto err_free_input;
+       }
+
        error = request_threaded_irq(pwron->irq, NULL, pwron_irq,
                                     IRQF_TRIGGER_HIGH |
                                        IRQF_TRIGGER_LOW |