All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Lambert <lambert.quentin@gmail.com>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Cc: Quentin Lambert <lambert.quentin@gmail.com>
Subject: [PATCH] stm class: Add a missing call to put_device
Date: Sat, 19 Nov 2016 18:22:41 +0000	[thread overview]
Message-ID: <20161119182241.9030-1-lambert.quentin@gmail.com> (raw)

Most error branches following the call to class_find_device contain
a call to put_device. This patch add calls to put_device where
they are missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/hwtracing/stm/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
 		return -ENODEV;
 
 	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
-	if (!stmf)
+	if (!stmf) {
+		put_device(dev);
 		return -ENOMEM;
+	}
 
 	stm_output_init(&stmf->output);
 	stmf->stm = to_stm_device(dev);

WARNING: multiple messages have this Message-ID (diff)
From: Quentin Lambert <lambert.quentin@gmail.com>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Cc: Quentin Lambert <lambert.quentin@gmail.com>
Subject: [PATCH] stm class: Add a missing call to put_device
Date: Sat, 19 Nov 2016 19:22:41 +0100	[thread overview]
Message-ID: <20161119182241.9030-1-lambert.quentin@gmail.com> (raw)

Most error branches following the call to class_find_device contain
a call to put_device. This patch add calls to put_device where
they are missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/hwtracing/stm/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
 		return -ENODEV;
 
 	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
-	if (!stmf)
+	if (!stmf) {
+		put_device(dev);
 		return -ENOMEM;
+	}
 
 	stm_output_init(&stmf->output);
 	stmf->stm = to_stm_device(dev);

             reply	other threads:[~2016-11-19 18:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-19 18:22 Quentin Lambert [this message]
2016-11-19 18:22 ` [PATCH] stm class: Add a missing call to put_device Quentin Lambert
2016-11-21  7:32 ` Alexander Shishkin
2016-11-21  7:32   ` Alexander Shishkin
2016-11-21  7:58   ` Quentin Lambert
2016-11-21  7:58     ` Quentin Lambert

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=20161119182241.9030-1-lambert.quentin@gmail.com \
    --to=lambert.quentin@gmail.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@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.