mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
media: i2c: rdacm21: Fix missing media_entity_cleanup()
The driver misses calling media_entity_cleanup() on the probe error path
and during remove, leaking resources if probe fails after entity
initialization or when the driver is unloaded.
Fix this by adding media_entity_cleanup() to the rdacm21_probe() error
handling path and to rdacm21_remove().
Fixes: a59f853b3b ("media: i2c: Add driver for RDACM21 camera module")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
parent
f4d4912e7f
commit
04c053379c
|
|
@ -588,10 +588,12 @@ static int rdacm21_probe(struct i2c_client *client)
|
|||
|
||||
ret = v4l2_async_register_subdev(&dev->sd);
|
||||
if (ret)
|
||||
goto error_free_ctrls;
|
||||
goto error_entity_cleanup;
|
||||
|
||||
return 0;
|
||||
|
||||
error_entity_cleanup:
|
||||
media_entity_cleanup(&dev->sd.entity);
|
||||
error_free_ctrls:
|
||||
v4l2_ctrl_handler_free(&dev->ctrls);
|
||||
error:
|
||||
|
|
@ -606,6 +608,7 @@ static void rdacm21_remove(struct i2c_client *client)
|
|||
|
||||
v4l2_async_unregister_subdev(&dev->sd);
|
||||
v4l2_ctrl_handler_free(&dev->ctrls);
|
||||
media_entity_cleanup(&dev->sd.entity);
|
||||
i2c_unregister_device(dev->isp);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user