media: sun4i-csi: clean up media device on probe errors
PATCH v2 1/1 media: sun4i-csi: clean up media device on probe errors
sun4i_csi_probe() initializes the media device before acquiring the MMIO resource, IRQ, clocks, reset control and media entity pads. Several of those failure paths return directly.
media_device_cleanup() is still required after media_device_init(), and a failed probe does not run the driver remove callback. Route those errors through the existing media-device cleanup path before returning.
---
Changes in v2:
- Fix the remaining sun4i_csi_dma_register() error path to use the renamed media-device cleanup label, fixing the build failure reported by Media CI.
drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-)
drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +20 -12
@@ -187,37 +187,45 @@ static int sun4i_csi_probe(struct platform_device *pdev) csi->v4l.mdev = &csi->mdev; csi->regs =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (csi->regs)) -return PTR_ERR (csi->regs); +if (IS_ERR (csi->regs)) { + ret =PTR_ERR (csi->regs); + goto err_clean_mdev; + } irq =platform_get_irq (pdev,0 ); -if (irq <0 ) -return irq; +if (irq <0 ) { + ret = irq; + goto err_clean_mdev; + } csi->bus_clk =devm_clk_get (&pdev->dev,"bus" );if (IS_ERR (csi->bus_clk)) {dev_err (&pdev->dev,"Couldn't get our bus clock\n" ); -return PTR_ERR (csi->bus_clk); + ret =PTR_ERR (csi->bus_clk); + goto err_clean_mdev; }if (csi->traits->has_isp) { csi->isp_clk =devm_clk_get (&pdev->dev,"isp" );if (IS_ERR (csi->isp_clk)) {dev_err (&pdev->dev,"Couldn't get our ISP clock\n" ); -return PTR_ERR (csi->isp_clk); + ret =PTR_ERR (csi->isp_clk); + goto err_clean_mdev; } } csi->ram_clk =devm_clk_get (&pdev->dev,"ram" );if (IS_ERR (csi->ram_clk)) {dev_err (&pdev->dev,"Couldn't get our ram clock\n" ); -return PTR_ERR (csi->ram_clk); + ret =PTR_ERR (csi->ram_clk); + goto err_clean_mdev; } csi->rst =devm_reset_control_get (&pdev->dev,NULL );if (IS_ERR (csi->rst)) {dev_err (&pdev->dev,"Couldn't get our reset line\n" ); -return PTR_ERR (csi->rst); + ret =PTR_ERR (csi->rst); + goto err_clean_mdev; }/* Initialize subdev */
@@ -236,17 +244,17 @@ static int sun4i_csi_probe(struct platform_device *pdev) ret =media_entity_pads_init (&subdev->entity,CSI_SUBDEV_PADS , csi->subdev_pads);if (ret <0 ) -return ret; + goto err_clean_mdev; csi->vdev_pad.flags =MEDIA_PAD_FL_SINK |MEDIA_PAD_FL_MUST_CONNECT ; vdev->entity.ops = &sun4i_csi_video_entity_ops; ret =media_entity_pads_init (&vdev->entity,1 , &csi->vdev_pad);if (ret <0 ) -return ret; + goto err_clean_mdev; ret =sun4i_csi_dma_register (csi, irq);if (ret) - goto err_clean_pad; + goto err_clean_mdev; ret =sun4i_csi_notifier_init (csi);if (ret)
@@ -266,7 +274,7 @@ static int sun4i_csi_probe(struct platform_device *pdev)media_device_unregister (&csi->mdev);sun4i_csi_dma_unregister (csi); -err_clean_pad: +err_clean_mdev:media_device_cleanup (&csi->mdev);return ret;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
I did not add Ricardo's Signed-off-by because this patch was submitted directly by me and has not been handled by Ricardo.
This looks like a Media CI false positive. Could you please confirm whether this report can be ignored?
Thanks,
Myeonghun
2026년 5월 7일 (목) 오전 5:39, Patchwork Integration <[email protected]>님이 작성:
Quoted 30 lines
Dear Myeonghun Pak:
Thanks for your patches! Unfortunately the Media CI robot detected some issues:
# Test media-patchstyle:./0001-media-sun4i-csi-clean-up-media-device-on-probe-error.patch media style
ERROR: ./0001-media-sun4i-csi-clean-up-media-device-on-probe-error.patch: Missing committer Ricardo Ribalda <[email protected]> Signed-off-byPlease fix your series, and upload a new version. If you have a patchwork account, do not forget to mark the current series as Superseded.
For more details, check the full report at:
https://linux-media.pages.freedesktop.org/-/users/patchwork/-/jobs/99166211/artifacts/report.htm .Best regards, and Happy Hacking!
Media CI robot on behalf of the linux-media community.---
Check the latest rules for contributing your patches at:
https://docs.kernel.org/driver-api/media/maintainer-entry-profile.htmlIf you believe that the CI is wrong, kindly open an issue at
https://gitlab.freedesktop.org/linux-media/media-ci/-/issues or reply-all to this message.