Skip to contentSkip to conversation

media: mali-c55: Free the ISP control handler on unregister

PATCH In review David Carlier 2 participants 2 messages Sep 6 – Sep 30

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: mali-c55: Free the ISP control handler on unregister

mali_c55_isp_init_controls() initialises isp->handler and adds the capabilities control, but mali_c55_unregister_isp() never frees it. Neither v4l2_device_unregister_subdev() nor v4l2_subdev_cleanup() touches sd->ctrl_handler, so the handler and its control are leaked on every unbind or module removal. The probe error path already frees it, and the TPG subdevice does so in its own unregister function.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
---
 drivers/media/platform/arm/mali-c55/mali-c55-isp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/arm/mali-c55/mali-c55-isp.c +1 -0
index e128adf6ee37..c45a3760e084 100644
@@ -641,6 +641,7 @@ void mali_c55_unregister_isp(struct mali_c55 *mali_c55)
 
 	mutex_destroy(&isp->capture_lock);
 	v4l2_device_unregister_subdev(&isp->sd);
+	v4l2_ctrl_handler_free(&isp->handler);
 	v4l2_subdev_cleanup(&isp->sd);
 	media_entity_cleanup(&isp->sd.entity);
 }
Signature · 1 line
2.55.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi David

Quoted 10 lines · David Carlier

mali_c55_isp_init_controls() initialises isp->handler and adds the capabilities control, but mali_c55_unregister_isp() never frees it. Neither v4l2_device_unregister_subdev() nor v4l2_subdev_cleanup() touches sd->ctrl_handler, so the handler and its control are leaked on every unbind or module removal. The probe error path already frees it, and the TPG subdevice does so in its own unregister function.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
Quoted 20 lines
---
 drivers/media/platform/arm/mali-c55/mali-c55-isp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/arm/mali-c55/mali-c55-isp.c +1 -1
index e128adf6ee37..c45a3760e084 100644
@@ -641,6 +641,7 @@ void mali_c55_unregister_isp(struct mali_c55 *mali_c55)
 
 	mutex_destroy(&isp->capture_lock);
 	v4l2_device_unregister_subdev(&isp->sd);
+	v4l2_ctrl_handler_free(&isp->handler);
 	v4l2_subdev_cleanup(&isp->sd);
 	media_entity_cleanup(&isp->sd.entity);
 }
--

2.55.0