lkml.org 
[lkml]   [2018]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] sh: maple: use put_device() instead of kfree()
Date
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/sh/maple/maple.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039..28674fe 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -393,7 +393,7 @@ static void maple_attach_driver(struct maple_device *mdev)
dev_warn(&mdev->dev, "could not register device at"
" (%d, %d), with error 0x%X\n", mdev->unit,
mdev->port, error);
- maple_free_dev(mdev);
+ put_device(&mdev->dev);
mdev = NULL;
return;
}
@@ -886,6 +886,7 @@ static int __init maple_bus_init(void)

cleanup:
printk(KERN_ERR "Maple bus registration failed\n");
+ put_device(&maple_bus);
return retval;
}
/* Push init to later to ensure hardware gets detected */
--
1.9.1
\
 
 \ /
  Last update: 2018-03-07 12:05    [W:0.035 / U:3.792 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site