Skip to content
Snippets Groups Projects
Commit f4172b08 authored by Johannes Berg's avatar Johannes Berg Committed by Richard Weinberger
Browse files

um: virtio: free vu_dev only with the contained struct device


Since struct device is refcounted, we shouldn't free the vu_dev
immediately when it's removed from the platform device, but only
when the references actually all go away. Move the freeing to
the release to accomplish that.

Fixes: 5d38f324 ("um: drivers: Add virtio vhost-user driver")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent e23fe90d
No related branches found
No related tags found
No related merge requests found
...@@ -1084,6 +1084,7 @@ static void virtio_uml_release_dev(struct device *d) ...@@ -1084,6 +1084,7 @@ static void virtio_uml_release_dev(struct device *d)
} }
os_close_file(vu_dev->sock); os_close_file(vu_dev->sock);
kfree(vu_dev);
} }
/* Platform device */ /* Platform device */
...@@ -1097,7 +1098,7 @@ static int virtio_uml_probe(struct platform_device *pdev) ...@@ -1097,7 +1098,7 @@ static int virtio_uml_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -EINVAL; return -EINVAL;
vu_dev = devm_kzalloc(&pdev->dev, sizeof(*vu_dev), GFP_KERNEL); vu_dev = kzalloc(sizeof(*vu_dev), GFP_KERNEL);
if (!vu_dev) if (!vu_dev)
return -ENOMEM; return -ENOMEM;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment