Skip to content

Commit

Permalink
media: zoran: convert zoran alloc to devm
Browse files Browse the repository at this point in the history
Allocate the zoran structure with devm_ functions permit to simplify
code.

Signed-off-by: Corentin Labbe <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
montjoie authored and mchehab committed Oct 1, 2020
1 parent ce72671 commit 6d1d9ba
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/staging/media/zoran/zoran_card.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,6 @@ static void zoran_remove(struct pci_dev *pdev)
exit_free:
v4l2_ctrl_handler_free(&zr->hdl);
v4l2_device_unregister(&zr->v4l2_dev);
kfree(zr);
}

void zoran_vdev_release(struct video_device *vdev)
Expand Down Expand Up @@ -1109,7 +1108,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENOENT;
}

zr = kzalloc(sizeof(*zr), GFP_KERNEL);
zr = devm_kzalloc(&pdev->dev, sizeof(*zr), GFP_KERNEL);
if (!zr)
return -ENOMEM;

Expand Down Expand Up @@ -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_device_unregister(&zr->v4l2_dev);
zr_free_mem:
kfree(zr);

return -ENODEV;
}
Expand Down

0 comments on commit 6d1d9ba

Please sign in to comment.