linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Jiri Kosina <jikos@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: David Arcari <darcari@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] HID: i2c-hid: exit if the IRQ is not valid
Date: Thu, 13 Oct 2016 11:30:45 +0200	[thread overview]
Message-ID: <1476351045-8829-3-git-send-email-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <1476351045-8829-1-git-send-email-benjamin.tissoires@redhat.com>

From: David Arcari <darcari@redhat.com>

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>
---
 drivers/hid/i2c-hid/i2c-hid.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 4cd606c..fe6b4e0 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;
-- 
2.7.4


  parent reply	other threads:[~2016-10-13  9:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13  9:30 [PATCH 0/2] Tiny modification of i2c-hid Benjamin Tissoires
2016-10-13  9:30 ` [PATCH 1/2] Revert "HID: i2c-hid: Add support for ACPI GPIO interrupts" Benjamin Tissoires
2016-10-13 10:24   ` Mika Westerberg
2016-10-13  9:30 ` Benjamin Tissoires [this message]
2016-10-13 10:25   ` [PATCH 2/2] HID: i2c-hid: exit if the IRQ is not valid Mika Westerberg
2016-10-14 13:50 ` [PATCH 0/2] Tiny modification of i2c-hid Jiri Kosina
2016-10-14 13:55   ` Benjamin Tissoires
2016-10-14 14:02 ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476351045-8829-3-git-send-email-benjamin.tissoires@redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=darcari@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).