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>
This commit is contained in:
Родитель
d811bcee1f
Коммит
351b2bcced
|
@ -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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче