summaryrefslogtreecommitdiff
path: root/drivers/hid/i2c-hid/i2c-hid.c
diff options
context:
space:
mode:
authorDavid Arcari <darcari@redhat.com>2016-10-13 11:30:45 +0200
committerJiri Kosina <jkosina@suse.cz>2016-10-14 16:02:05 +0200
commit93d26aeab54cc91119760bc4f1f22bff9a987d70 (patch)
treef0908ebcda5e49602518fd95f5323e0323eb4f0b /drivers/hid/i2c-hid/i2c-hid.c
parentba18a9314a94f4a54b4d0c5e0f1dc85af28eca35 (diff)
HID: i2c-hid: exit if the IRQ is not valid
When i2c-core doesn't find the IRQ associated to the GPIO because the gpiochip is not available, it assigns -EPROBE_DEFER to the irq. We need to bail out there and on any other error in an IRQ. Signed-off-by: David Arcari <darcari@redhat.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/i2c-hid/i2c-hid.c')
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 4cd606c0d89c..fe6b4e0eab4a 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -956,6 +956,13 @@ static int i2c_hid_probe(struct i2c_client *client,
return -EINVAL;
}
+ if (client->irq < 0) {
+ if (client->irq != -EPROBE_DEFER)
+ dev_err(&client->dev,
+ "HID over i2c doesn't have a valid IRQ\n");
+ return client->irq;
+ }
+
ihid = kzalloc(sizeof(struct i2c_hid), GFP_KERNEL);
if (!ihid)
return -ENOMEM;