1
0
Fork 0

xen: xenbus: 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>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
hifive-unleashed-5.1
Arvind Yadav 2018-03-06 15:40:37 +05:30 committed by Juergen Gross
parent d811bcee1f
commit 351b2bcced
1 changed files with 4 additions and 1 deletions

View File

@ -466,8 +466,11 @@ int xenbus_probe_node(struct xen_bus_type *bus,
/* Register with generic device framework. */
err = device_register(&xendev->dev);
if (err)
if (err) {
put_device(&xendev->dev);
xendev = NULL;
goto fail;
}
return 0;
fail: