Merge branch 'x86-xsave-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / drivers / input / misc / soc_button_array.c
index 20c80f543d5e56fbe59f15403f2d64d9cb791cff..e34dfc29beb3bb920d9548c2bd4a057d10297179 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/acpi.h>
 #include <linux/gpio/consumer.h>
 #include <linux/gpio_keys.h>
-#include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/pnp.h>
 
@@ -84,6 +83,9 @@ soc_button_device_create(struct pnp_dev *pdev,
                                       sizeof(*gpio_keys_pdata) +
                                        sizeof(*gpio_keys) * MAX_NBUTTONS,
                                       GFP_KERNEL);
+       if (!gpio_keys_pdata)
+               return ERR_PTR(-ENOMEM);
+
        gpio_keys = (void *)(gpio_keys_pdata + 1);
 
        for (info = button_info; info->name; info++) {