Skip to contentSkip to conversation

media: ti: vpe: unwind v4l2 device registration on probe error

PATCH In review 박명훈 2 participants 2 messages Apr 26 – May 4

Subsystems (3)
lore
Share & tools
lore

박명훈

author
#0 lore raw

PATCH 1/1 media: ti: vpe: unwind v4l2 device registration on probe error

From: Myeonghun Pak <[email protected]>

If the vpe_top resource is missing, vpe_probe() returns -ENODEV after v4l2_device_register() has succeeded. Probe failures do not call the driver's remove callback, so the v4l2 device remains registered on that error path.

Route that failure through the existing v4l2_device_unregister() unwind label, matching the other errors after v4l2_device_register().

Fixes 4d59c7d45585 ("media: ti-vpe: vpe: Add missing null pointer checks")

---
Notes for send preparation:
- Fixes tag was validated against upstream history; the local row worktree remains shallow/grafted and cannot verify it by itself.
- Build was not completed because this worktree has no .config.

 drivers/media/platform/ti/vpe/vpe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/ti/vpe/vpe.c +2 -1
index a7e5a85e72..81bd1f9cee 100644
@@ -2539,7 +2539,8 @@ static int vpe_probe(struct platform_device *pdev)
 						"vpe_top");
 	if (!dev->res) {
 		dev_err(&pdev->dev, "missing 'vpe_top' resources data\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto v4l2_dev_unreg;
 	}
 
 	/*
Signature · 1 line
2.39.5
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 15 lines · 박명훈

From: Myeonghun Pak <[email protected]>

If the vpe_top resource is missing, vpe_probe() returns -ENODEV after v4l2_device_register() has succeeded. Probe failures do not call the driver's remove callback, so the v4l2 device remains registered on that error path.

Route that failure through the existing v4l2_device_unregister() unwind label, matching the other errors after v4l2_device_register().

Fixes 4d59c7d45585 ("media: ti-vpe: vpe: Add missing null pointer checks")
Quoted 6 lines

---
Notes for send preparation:
- Fixes tag was validated against upstream history; the local row worktree remains shallow/grafted and cannot verify it by itself.
- Build was not completed because this worktree has no .config.

Why can't you build test?

Having said that, the fix seems trivial and correct to me. Hence

Quoted 17 lines
  drivers/media/platform/ti/vpe/vpe.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/ti/vpe/vpe.c +2 -1
index a7e5a85e72..81bd1f9cee 100644
@@ -2539,7 +2539,8 @@ static int vpe_probe(struct platform_device *pdev)
  						"vpe_top");
  	if (!dev->res) {
  		dev_err(&pdev->dev, "missing 'vpe_top' resources data\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto v4l2_dev_unreg;
  	}
 
  	/*