[PATCH RFC] media: msi2500: propagate control import errors
From: Slavin Liu
Date: Fri Sep 11 2026 - 02:14:11 EST
Importing subdevice controls allocates new references and can fail
even when the source controls exist. Abort probe through the existing
control cleanup path rather than exposing a partial handler.
Detected by static analysis and reviewed with AI-assisted source auditing.
Fixes: 2e68f841a5d1 ("[media] msi3101: use msi001 tuner driver")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@xxxxxxxxxx>
---
drivers/media/usb/msi2500/msi2500.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
index 282256ab812a..4c4508d2977c 100644
--- a/drivers/media/usb/msi2500/msi2500.c
+++ b/drivers/media/usb/msi2500/msi2500.c
@@ -1268,7 +1268,9 @@ static int msi2500_probe(struct usb_interface *intf,
}
/* currently all controls are from subdev */
- v4l2_ctrl_add_handler(&dev->hdl, sd->ctrl_handler, NULL, true);
+ ret = v4l2_ctrl_add_handler(&dev->hdl, sd->ctrl_handler, NULL, true);
+ if (ret)
+ goto err_free_controls;
dev->v4l2_dev.ctrl_handler = &dev->hdl;
dev->vdev.v4l2_dev = &dev->v4l2_dev;