1
0
Fork 0

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>
hifive-unleashed-5.1
Arvind Yadav 2018-03-09 14:09:59 +00:00 committed by Greg Kroah-Hartman
parent 8de602885c
commit bd329f028f
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}