From: Axel Lin <[email protected]>

Add error checking and return -ENOMEM if input_allocate_device() fail.

Signed-off-by: Axel Lin <[email protected]>
Acked-by: Thomas Renninger <[email protected]>
Cc: Matthew Garrett <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 drivers/platform/x86/hp-wmi.c |    2 ++
 1 file changed, 2 insertions(+)

diff -puN 
drivers/platform/x86/hp-wmi.c~hp-wmi-add-return-value-checking-for-input_allocate_device
 drivers/platform/x86/hp-wmi.c
--- 
a/drivers/platform/x86/hp-wmi.c~hp-wmi-add-return-value-checking-for-input_allocate_device
+++ a/drivers/platform/x86/hp-wmi.c
@@ -527,6 +527,8 @@ static int __init hp_wmi_input_setup(voi
        int err;
 
        hp_wmi_input_dev = input_allocate_device();
+       if (!hp_wmi_input_dev)
+               return -ENOMEM;
 
        hp_wmi_input_dev->name = "HP WMI hotkeys";
        hp_wmi_input_dev->phys = "wmi/input0";
_
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to