Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: ti: cal: remove unnecessary error check
@ 2026-09-22 10:34 Dan Carpenter
  2026-09-23 10:22 ` Yemike Abhilash Chandra
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-09-22 10:34 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Yemike Abhilash Chandra, Mauro Carvalho Chehab, linux-media,
	kernel-janitors

The v4l2_subdev_lock_and_get_active_state() function never returns
error pointers.  As the comments explain, it "returns the locked active
state for the subdevice, or NULL if the subdev does not support active
state."  None of the other callers check for an error pointer return.

Delete this unnecessary check.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I feel like if we don't delete the IS_ERR() check someone will eventually
try to convert it into a NULL check which would be a bug.

 drivers/media/platform/ti/cal/cal-video.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/platform/ti/cal/cal-video.c b/drivers/media/platform/ti/cal/cal-video.c
index 59f0cc4f0d1a..1990cab77344 100644
--- a/drivers/media/platform/ti/cal/cal-video.c
+++ b/drivers/media/platform/ti/cal/cal-video.c
@@ -130,8 +130,6 @@ static int cal_call_active_state_set_fmt(struct v4l2_subdev *source,
 	int ret;
 
 	source_state = v4l2_subdev_lock_and_get_active_state(source);
-	if (IS_ERR(source_state))
-		return PTR_ERR(source_state);
 
 	ret = v4l2_subdev_call(source, pad, set_fmt, NULL, source_state, fmt);
 	if (source_state)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: ti: cal: remove unnecessary error check
  2026-09-22 10:34 [PATCH] media: ti: cal: remove unnecessary error check Dan Carpenter
@ 2026-09-23 10:22 ` Yemike Abhilash Chandra
  0 siblings, 0 replies; 2+ messages in thread
From: Yemike Abhilash Chandra @ 2026-09-23 10:22 UTC (permalink / raw)
  To: Dan Carpenter, Sakari Ailus
  Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors

Hi Dan,
Thank you for the patch.

On 22/09/26 16:04, Dan Carpenter wrote:
> The v4l2_subdev_lock_and_get_active_state() function never returns
> error pointers.  As the comments explain, it "returns the locked active
> state for the subdevice, or NULL if the subdev does not support active
> state."  None of the other callers check for an error pointer return.
> 
> Delete this unnecessary check.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> I feel like if we don't delete the IS_ERR() check someone will eventually
> try to convert it into a NULL check which would be a bug.
> 

It makes sense for me. Hence

Reviewed-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com>

Thanks and regards,
Yemike Abhilash Chandra

>   drivers/media/platform/ti/cal/cal-video.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/media/platform/ti/cal/cal-video.c b/drivers/media/platform/ti/cal/cal-video.c
> index 59f0cc4f0d1a..1990cab77344 100644
> --- a/drivers/media/platform/ti/cal/cal-video.c
> +++ b/drivers/media/platform/ti/cal/cal-video.c
> @@ -130,8 +130,6 @@ static int cal_call_active_state_set_fmt(struct v4l2_subdev *source,
>   	int ret;
>   
>   	source_state = v4l2_subdev_lock_and_get_active_state(source);
> -	if (IS_ERR(source_state))
> -		return PTR_ERR(source_state);
>   
>   	ret = v4l2_subdev_call(source, pad, set_fmt, NULL, source_state, fmt);
>   	if (source_state)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-23 10:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-22 10:34 [PATCH] media: ti: cal: remove unnecessary error check Dan Carpenter
2026-09-23 10:22 ` Yemike Abhilash Chandra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox