summaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2018-03-06 15:40:37 +0530
committerJuergen Gross <jgross@suse.com>2018-03-08 15:30:30 +0100
commit351b2bccede1cb673ec7957b35ea997ea24c8884 (patch)
treead522233fb56749113f957127cdd6aecb70d6ef4 /drivers/xen
parentd811bcee1f7a379cad893fdee4c8db5775963b7f (diff)
downloadlinux-stable-351b2bccede1cb673ec7957b35ea997ea24c8884.tar.gz
linux-stable-351b2bccede1cb673ec7957b35ea997ea24c8884.tar.bz2
linux-stable-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>
Diffstat (limited to 'drivers/xen')
-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: