瀏覽代碼

hp-wmi: add return value checking for input_allocate_device()

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>
Axel Lin 15 年之前
父節點
當前提交
bc28596a8f
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/platform/x86/hp-wmi.c

+ 2 - 0
drivers/platform/x86/hp-wmi.c

@@ -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";