Skip to content

Commit

Permalink
HID: i2c-hid: exit if the IRQ is not valid
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Arcari authored and Jiri Kosina committed Oct 14, 2016
1 parent ba18a93 commit 93d26ae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/hid/i2c-hid/i2c-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 93d26ae

Please sign in to comment.