hp-wmi: add return value checking for input_allocate_device()
authorAxel Lin <axel.lin@gmail.com>
Tue, 20 Jul 2010 22:19:51 +0000 (15:19 -0700)
committerMatthew Garrett <mjg@redhat.com>
Tue, 3 Aug 2010 13:49:02 +0000 (09:49 -0400)
Add error checking and return -ENOMEM if input_allocate_device() fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
drivers/platform/x86/hp-wmi.c

index 34b4178..c5f95d1 100644 (file)
@@ -527,6 +527,8 @@ static int __init hp_wmi_input_setup(void)
        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";