mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique()
@ 2026-05-22  6:55 Chen Ni
  2026-05-22  8:25 ` Mehdi Djait
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chen Ni @ 2026-05-22  6:55 UTC (permalink / raw)
  To: mehdi.djait, michael.riesch
  Cc: mchehab, heiko, hverkuil+cisco, gerald.loacker, bryan.odonoghue,
	linux-media, linux-arm-kernel, linux-rockchip, linux-kernel,
	Chen Ni

The media_entity_remote_source_pad_unique() function returns an error
pointer on failure, not NULL. Fix the check to use IS_ERR() and return
PTR_ERR() to correctly handle allocation failures.

Fixes: 501802e2ad51 ("media: rockchip: rkcif: add abstraction for dma blocks")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/media/platform/rockchip/rkcif/rkcif-stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
index 3130d420ad55..542aa877919d 100644
--- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
+++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
@@ -466,7 +466,7 @@ static int rkcif_stream_link_validate(struct media_link *link)
 	struct rkcif_stream *stream = to_rkcif_stream(vdev);
 	int ret = -EINVAL;
 
-	if (!media_entity_remote_source_pad_unique(link->sink->entity))
+	if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity)))
 		return -ENOTCONN;
 
 	sd = media_entity_to_v4l2_subdev(link->source->entity);
-- 
2.25.1


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

* Re: [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique()
  2026-05-22  6:55 [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique() Chen Ni
@ 2026-05-22  8:25 ` Mehdi Djait
  2026-06-03  6:51 ` Jai Luthra
  2026-06-03  9:50 ` Michael Riesch
  2 siblings, 0 replies; 4+ messages in thread
From: Mehdi Djait @ 2026-05-22  8:25 UTC (permalink / raw)
  To: Chen Ni
  Cc: michael.riesch, mchehab, heiko, hverkuil+cisco, gerald.loacker,
	bryan.odonoghue, linux-media, linux-arm-kernel, linux-rockchip,
	linux-kernel

Hello Chen,

Thank you for the patch.

I see this issue in the rpi cfe driver also.

On Fri, May 22, 2026 at 02:55:48PM +0800, Chen Ni wrote:
> The media_entity_remote_source_pad_unique() function returns an error
> pointer on failure, not NULL. Fix the check to use IS_ERR() and return
> PTR_ERR() to correctly handle allocation failures.
> 
> Fixes: 501802e2ad51 ("media: rockchip: rkcif: add abstraction for dma blocks")

Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com>

> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  drivers/media/platform/rockchip/rkcif/rkcif-stream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> index 3130d420ad55..542aa877919d 100644
> --- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> +++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> @@ -466,7 +466,7 @@ static int rkcif_stream_link_validate(struct media_link *link)
>  	struct rkcif_stream *stream = to_rkcif_stream(vdev);
>  	int ret = -EINVAL;
>  
> -	if (!media_entity_remote_source_pad_unique(link->sink->entity))
> +	if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity)))
>  		return -ENOTCONN;
>  
>  	sd = media_entity_to_v4l2_subdev(link->source->entity);

--
Kind Regards
Mehdi Djait

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

* Re: [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique()
  2026-05-22  6:55 [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique() Chen Ni
  2026-05-22  8:25 ` Mehdi Djait
@ 2026-06-03  6:51 ` Jai Luthra
  2026-06-03  9:50 ` Michael Riesch
  2 siblings, 0 replies; 4+ messages in thread
From: Jai Luthra @ 2026-06-03  6:51 UTC (permalink / raw)
  To: Chen Ni, mehdi.djait, michael.riesch
  Cc: mchehab, heiko, hverkuil+cisco, gerald.loacker, bryan.odonoghue,
	linux-media, linux-arm-kernel, linux-rockchip, linux-kernel,
	Chen Ni

Quoting Chen Ni (2026-05-22 12:25:48)
> The media_entity_remote_source_pad_unique() function returns an error
> pointer on failure, not NULL. Fix the check to use IS_ERR() and return
> PTR_ERR() to correctly handle allocation failures.
> 
> Fixes: 501802e2ad51 ("media: rockchip: rkcif: add abstraction for dma blocks")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>

Thanks,
    Jai

> ---
>  drivers/media/platform/rockchip/rkcif/rkcif-stream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> index 3130d420ad55..542aa877919d 100644
> --- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> +++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> @@ -466,7 +466,7 @@ static int rkcif_stream_link_validate(struct media_link *link)
>         struct rkcif_stream *stream = to_rkcif_stream(vdev);
>         int ret = -EINVAL;
>  
> -       if (!media_entity_remote_source_pad_unique(link->sink->entity))
> +       if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity)))
>                 return -ENOTCONN;
>  
>         sd = media_entity_to_v4l2_subdev(link->source->entity);
> -- 
> 2.25.1
> 
>

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

* Re: [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique()
  2026-05-22  6:55 [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique() Chen Ni
  2026-05-22  8:25 ` Mehdi Djait
  2026-06-03  6:51 ` Jai Luthra
@ 2026-06-03  9:50 ` Michael Riesch
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Riesch @ 2026-06-03  9:50 UTC (permalink / raw)
  To: Chen Ni, mehdi.djait
  Cc: mchehab, heiko, hverkuil+cisco, gerald.loacker, bryan.odonoghue,
	linux-media, linux-arm-kernel, linux-rockchip, linux-kernel

Hi Chen,

Thanks for the fix!

On 5/22/26 08:55, Chen Ni wrote:
> The media_entity_remote_source_pad_unique() function returns an error
> pointer on failure, not NULL. Fix the check to use IS_ERR() and return
> PTR_ERR() to correctly handle allocation failures.
> 
> Fixes: 501802e2ad51 ("media: rockchip: rkcif: add abstraction for dma blocks")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Michael Riesch <michael.riesch@collabora.com>

Best regards,
Michael

> ---
>  drivers/media/platform/rockchip/rkcif/rkcif-stream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> index 3130d420ad55..542aa877919d 100644
> --- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> +++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> @@ -466,7 +466,7 @@ static int rkcif_stream_link_validate(struct media_link *link)
>  	struct rkcif_stream *stream = to_rkcif_stream(vdev);
>  	int ret = -EINVAL;
>  
> -	if (!media_entity_remote_source_pad_unique(link->sink->entity))
> +	if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity)))
>  		return -ENOTCONN;
>  
>  	sd = media_entity_to_v4l2_subdev(link->source->entity);


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

end of thread, other threads:[~2026-06-03  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-22  6:55 [PATCH] media: rockchip: rkcif: Fix error handling for media_entity_remote_source_pad_unique() Chen Ni
2026-05-22  8:25 ` Mehdi Djait
2026-06-03  6:51 ` Jai Luthra
2026-06-03  9:50 ` Michael Riesch

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

all inboxes | Powered by JetHome®