mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
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>
This commit is contained in:
parent
8de602885c
commit
bd329f028f
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user