summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2018-03-06 11:10:37 +0100
committerJuergen Gross <jgross@suse.com>2018-03-08 15:30:30 +0100
commit351b2bccede1cb673ec7957b35ea997ea24c8884 (patch)
treead522233fb56749113f957127cdd6aecb70d6ef4
parentpvcalls-front: 64-bit align flags (diff)
downloadlinux-351b2bccede1cb673ec7957b35ea997ea24c8884.tar.xz
linux-351b2bccede1cb673ec7957b35ea997ea24c8884.zip
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>
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c5
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: