media: platform: sunxi: sun6i-csi: fix error return code of sun6i_video_start_streaming()
diff mbox series

Message ID 20210306141528.18925-1-baijiaju1990@gmail.com
State Accepted
Commit f3d384e36630e2a552d874e422835606d9cf230a
Headers show
Series
  • media: platform: sunxi: sun6i-csi: fix error return code of sun6i_video_start_streaming()
Related show

Commit Message

Jia-Ju Bai March 6, 2021, 2:15 p.m. UTC
When sun6i_video_remote_subdev() returns NULL to subdev, no error return
code of sun6i_video_start_streaming() is assigned.
To fix this bug, ret is assigned with -EINVAL in this case.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Chen-Yu Tsai March 7, 2021, 12:47 p.m. UTC | #1
On Sat, Mar 6, 2021 at 10:15 PM Jia-Ju Bai <baijiaju1990@gmail.com> wrote:
>
> When sun6i_video_remote_subdev() returns NULL to subdev, no error return
> code of sun6i_video_start_streaming() is assigned.
> To fix this bug, ret is assigned with -EINVAL in this case.
>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

This should have the tag:

Fixes: 5cc7522d8965 ("media: sun6i: Add support for Allwinner CSI V3s")

Please try to add them when fixing bugs. And this should also be tagged
for stable, so

Cc: <stable@kernel.org>

Otherwise,

Acked-by: Chen-Yu Tsai <wens@csie.org>
Jia-Ju Bai March 8, 2021, 2:54 a.m. UTC | #2
On 2021/3/7 20:47, Chen-Yu Tsai wrote:
> On Sat, Mar 6, 2021 at 10:15 PM Jia-Ju Bai <baijiaju1990@gmail.com> wrote:
>> When sun6i_video_remote_subdev() returns NULL to subdev, no error return
>> code of sun6i_video_start_streaming() is assigned.
>> To fix this bug, ret is assigned with -EINVAL in this case.
>>
>> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
>> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> This should have the tag:
>
> Fixes: 5cc7522d8965 ("media: sun6i: Add support for Allwinner CSI V3s")
>
> Please try to add them when fixing bugs. And this should also be tagged
> for stable, so
>
> Cc: <stable@kernel.org>
>
> Otherwise,
>
> Acked-by: Chen-Yu Tsai <wens@csie.org>

Thanks for the advice :)
I will add the fixes and stable tags in my future patches.


Best wishes,
Jia-Ju Bai

Patch
diff mbox series

diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
index b55de9ab64d8..3181d0781b61 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
@@ -151,8 +151,10 @@  static int sun6i_video_start_streaming(struct vb2_queue *vq, unsigned int count)
 	}
 
 	subdev = sun6i_video_remote_subdev(video, NULL);
-	if (!subdev)
+	if (!subdev) {
+		ret = -EINVAL;
 		goto stop_media_pipeline;
+	}
 
 	config.pixelformat = video->fmt.fmt.pix.pixelformat;
 	config.code = video->mbus_code;