All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hid: intel-ish-hid: use put_device() instead of kfree()
@ 2018-03-30 11:26 Arvind Yadav
  2018-04-26 12:37 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2018-03-30 11:26 UTC (permalink / raw)
  To: srinivas.pandruvada, jikos, benjamin.tissoires; +Cc: linux-kernel, linux-input

Never directly free @dev after calling device_register(), even
if it returned an error. Always use put_device() to give up the
reference initialized.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index f272cdd..2623a56 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -418,7 +418,7 @@ static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev,
 		list_del(&device->device_link);
 		spin_unlock_irqrestore(&dev->device_list_lock, flags);
 		dev_err(dev->devc, "Failed to register ISHTP client device\n");
-		kfree(device);
+		put_device(&device->dev);
 		return NULL;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hid: intel-ish-hid: use put_device() instead of kfree()
  2018-03-30 11:26 [PATCH] hid: intel-ish-hid: use put_device() instead of kfree() Arvind Yadav
@ 2018-04-26 12:37 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2018-04-26 12:37 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: srinivas.pandruvada, benjamin.tissoires, linux-kernel, linux-input

On Fri, 30 Mar 2018, Arvind Yadav wrote:

> Never directly free @dev after calling device_register(), even
> if it returned an error. Always use put_device() to give up the
> reference initialized.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

Applied, thank you.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-26 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-30 11:26 [PATCH] hid: intel-ish-hid: use put_device() instead of kfree() Arvind Yadav
2018-04-26 12:37 ` Jiri Kosina

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.