[PATCH] media: i2c: ar0521: remove duplicate media entity cleanup

Guangshuo Li posted 1 patch 1 week, 2 days ago
drivers/media/i2c/ar0521.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] media: i2c: ar0521: remove duplicate media entity cleanup
Posted by Guangshuo Li 1 week, 2 days ago
The error path taken when ar0521_power_on() fails calls
media_entity_cleanup() at the disable label and then falls through to
the entity_cleanup label, where media_entity_cleanup() is called again.

There is no need to clean up the media entity twice. Remove the first
call and let all error paths converge on the common entity_cleanup
label.

This issue was found by manual code inspection.

Fixes: 852b50aeed15 ("media: On Semi AR0521 sensor driver")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/media/i2c/ar0521.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c
index ed324c2d87aa..be68789eb8f5 100644
--- a/drivers/media/i2c/ar0521.c
+++ b/drivers/media/i2c/ar0521.c
@@ -1142,7 +1142,6 @@ static int ar0521_probe(struct i2c_client *client)
 
 disable:
 	v4l2_async_unregister_subdev(&sensor->sd);
-	media_entity_cleanup(&sensor->sd.entity);
 free_ctrls:
 	v4l2_ctrl_handler_free(&sensor->ctrls.handler);
 entity_cleanup:
-- 
2.43.0
Re: [PATCH] media: i2c: ar0521: remove duplicate media entity cleanup
Posted by Krzysztof Hałasa 1 week, 2 days ago
Hi Guangshuo,

Guangshuo Li <lgs201920130244@gmail.com> writes:

> There is no need to clean up the media entity twice.

Definitely.
Thanks for fixing this.

Acked-by: Krzysztof Hałasa <khalasa@piap.pl>

> Fixes: 852b50aeed15 ("media: On Semi AR0521 sensor driver")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> --- a/drivers/media/i2c/ar0521.c
> +++ b/drivers/media/i2c/ar0521.c
> @@ -1142,7 +1142,6 @@ static int ar0521_probe(struct i2c_client *client)
>
>  disable:
>         v4l2_async_unregister_subdev(&sensor->sd);
> -       media_entity_cleanup(&sensor->sd.entity);
>  free_ctrls:
>         v4l2_ctrl_handler_free(&sensor->ctrls.handler);
>  entity_cleanup:

-- 
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa