diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2018-03-06 13:10:37 +0300 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2018-03-08 17:30:30 +0300 |
commit | 351b2bccede1cb673ec7957b35ea997ea24c8884 (patch) | |
tree | ad522233fb56749113f957127cdd6aecb70d6ef4 /drivers | |
parent | d811bcee1f7a379cad893fdee4c8db5775963b7f (diff) | |
download | linux-351b2bccede1cb673ec7957b35ea997ea24c8884.tar.xz |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 74888cacd0b0..ec9eb4fba59c 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -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: |