From: Axel Lin <axel.lin@gmail.com>
Date: Tue, 20 Jul 2010 22:19:51 +0000 (-0700)
Subject: hp-wmi: add return value checking for input_allocate_device()
X-Git-Tag: firefly_0821_release~9833^2~1314^2~37
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bc28596a8fe5034ef776b0be2e0bf5629a31f746;p=firefly-linux-kernel-4.4.55.git

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>
---

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 34b417848e29..c5f95d1e0315 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/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";