Commit 6d1d9ba2 authored by Corentin Labbe's avatar Corentin Labbe Committed by Mauro Carvalho Chehab

media: zoran: convert zoran alloc to devm

Allocate the zoran structure with devm_ functions permit to simplify
code.
Signed-off-by: default avatarCorentin Labbe <clabbe@baylibre.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent ce72671d
...@@ -1024,7 +1024,6 @@ static void zoran_remove(struct pci_dev *pdev) ...@@ -1024,7 +1024,6 @@ static void zoran_remove(struct pci_dev *pdev)
exit_free: exit_free:
v4l2_ctrl_handler_free(&zr->hdl); v4l2_ctrl_handler_free(&zr->hdl);
v4l2_device_unregister(&zr->v4l2_dev); v4l2_device_unregister(&zr->v4l2_dev);
kfree(zr);
} }
void zoran_vdev_release(struct video_device *vdev) void zoran_vdev_release(struct video_device *vdev)
...@@ -1109,7 +1108,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1109,7 +1108,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENOENT; return -ENOENT;
} }
zr = kzalloc(sizeof(*zr), GFP_KERNEL); zr = devm_kzalloc(&pdev->dev, sizeof(*zr), GFP_KERNEL);
if (!zr) if (!zr)
return -ENOMEM; return -ENOMEM;
...@@ -1298,7 +1297,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1298,7 +1297,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
v4l2_ctrl_handler_free(&zr->hdl); v4l2_ctrl_handler_free(&zr->hdl);
v4l2_device_unregister(&zr->v4l2_dev); v4l2_device_unregister(&zr->v4l2_dev);
zr_free_mem: zr_free_mem:
kfree(zr);
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment