mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
media: rcar_fdp1: Fix refcount leak in probe and remove function
rcar_fcp_get() take reference, which should be balanced with
rcar_fcp_put(). Add missing rcar_fcp_put() in fdp1_remove and
the error paths of fdp1_probe() to fix this.
Fixes: 4710b752e0 ("[media] v4l: Add Renesas R-Car FDP1 Driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
[hverkuil: resolve merge conflict, remove() is now void]
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
committed by
Hans Verkuil
parent
1dc30075fb
commit
c766c90faf
@@ -2313,8 +2313,10 @@ static int fdp1_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
/* Determine our clock rate */
|
/* Determine our clock rate */
|
||||||
clk = clk_get(&pdev->dev, NULL);
|
clk = clk_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(clk))
|
if (IS_ERR(clk)) {
|
||||||
return PTR_ERR(clk);
|
ret = PTR_ERR(clk);
|
||||||
|
goto put_dev;
|
||||||
|
}
|
||||||
|
|
||||||
fdp1->clk_rate = clk_get_rate(clk);
|
fdp1->clk_rate = clk_get_rate(clk);
|
||||||
clk_put(clk);
|
clk_put(clk);
|
||||||
@@ -2323,7 +2325,7 @@ static int fdp1_probe(struct platform_device *pdev)
|
|||||||
ret = v4l2_device_register(&pdev->dev, &fdp1->v4l2_dev);
|
ret = v4l2_device_register(&pdev->dev, &fdp1->v4l2_dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
v4l2_err(&fdp1->v4l2_dev, "Failed to register video device\n");
|
v4l2_err(&fdp1->v4l2_dev, "Failed to register video device\n");
|
||||||
return ret;
|
goto put_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* M2M registration */
|
/* M2M registration */
|
||||||
@@ -2393,6 +2395,8 @@ release_m2m:
|
|||||||
unreg_dev:
|
unreg_dev:
|
||||||
v4l2_device_unregister(&fdp1->v4l2_dev);
|
v4l2_device_unregister(&fdp1->v4l2_dev);
|
||||||
|
|
||||||
|
put_dev:
|
||||||
|
rcar_fcp_put(fdp1->fcp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2404,6 +2408,7 @@ static void fdp1_remove(struct platform_device *pdev)
|
|||||||
video_unregister_device(&fdp1->vfd);
|
video_unregister_device(&fdp1->vfd);
|
||||||
v4l2_device_unregister(&fdp1->v4l2_dev);
|
v4l2_device_unregister(&fdp1->v4l2_dev);
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
|
rcar_fcp_put(fdp1->fcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __maybe_unused fdp1_pm_runtime_suspend(struct device *dev)
|
static int __maybe_unused fdp1_pm_runtime_suspend(struct device *dev)
|
||||||
|
|||||||
Reference in New Issue
Block a user