diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2018-03-09 14:09:59 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-15 17:55:52 +0100 |
commit | bd329f028f1cd51c7623c326147af07c6d832193 (patch) | |
tree | 62d02dbc0e99853b9238c5245e8dd3383b0c2171 | |
parent | 8de602885cd8bf56b05b668aee574bd8a241c33f (diff) |
slimbus: core: use put_device() instead of kfree()
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>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/slimbus/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index 4988a8f4d905..7ddfc675b131 100644 --- a/drivers/slimbus/core.c +++ b/drivers/slimbus/core.c @@ -141,7 +141,7 @@ static struct slim_device *slim_alloc_device(struct slim_controller *ctrl, sbdev->e_addr = *eaddr; ret = slim_add_device(ctrl, sbdev, node); if (ret) { - kfree(sbdev); + put_device(&sbdev->dev); return NULL; } |