All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>, dh.herrmann@googlemail.com
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: [patch -next] HID: unlock on error path in hid_device_probe()
Date: Wed, 24 Aug 2011 11:27:46 +0000	[thread overview]
Message-ID: <20110824112745.GB5975@shale.localdomain> (raw)

We recently introduced locking into this function, but we missed an
error path which needs an unlock.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 582be00..ed0cd09 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1643,8 +1643,10 @@ static int hid_device_probe(struct device *dev)
 
 	if (!hdev->driver) {
 		id = hid_match_device(hdev, hdrv);
-		if (id = NULL)
-			return -ENODEV;
+		if (id = NULL) {
+			ret = -ENODEV;
+			goto unlock;
+		}
 
 		hdev->driver = hdrv;
 		if (hdrv->probe) {
@@ -1657,7 +1659,7 @@ static int hid_device_probe(struct device *dev)
 		if (ret)
 			hdev->driver = NULL;
 	}
-
+unlock:
 	up(&hdev->driver_lock);
 	return ret;
 }

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>, dh.herrmann@googlemail.com
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: [patch -next] HID: unlock on error path in hid_device_probe()
Date: Wed, 24 Aug 2011 14:27:46 +0300	[thread overview]
Message-ID: <20110824112745.GB5975@shale.localdomain> (raw)

We recently introduced locking into this function, but we missed an
error path which needs an unlock.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 582be00..ed0cd09 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1643,8 +1643,10 @@ static int hid_device_probe(struct device *dev)
 
 	if (!hdev->driver) {
 		id = hid_match_device(hdev, hdrv);
-		if (id == NULL)
-			return -ENODEV;
+		if (id == NULL) {
+			ret = -ENODEV;
+			goto unlock;
+		}
 
 		hdev->driver = hdrv;
 		if (hdrv->probe) {
@@ -1657,7 +1659,7 @@ static int hid_device_probe(struct device *dev)
 		if (ret)
 			hdev->driver = NULL;
 	}
-
+unlock:
 	up(&hdev->driver_lock);
 	return ret;
 }

             reply	other threads:[~2011-08-24 11:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 11:27 Dan Carpenter [this message]
2011-08-24 11:27 ` [patch -next] HID: unlock on error path in hid_device_probe() Dan Carpenter
2011-08-24 12:26 ` David Herrmann
2011-08-24 12:26   ` David Herrmann
2011-08-24 14:40 ` Jiri Kosina
2011-08-24 14:40   ` 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=20110824112745.GB5975@shale.localdomain \
    --to=error27@gmail.com \
    --cc=dh.herrmann@googlemail.com \
    --cc=jkosina@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.