| From e390722182d10047372c3abd5fd45f387b62dfe7 Mon Sep 17 00:00:00 2001 |
| From: Hans Verkuil <hverkuil-cisco@xs4all.nl> |
| Date: Tue, 26 Feb 2019 07:54:22 -0500 |
| Subject: media: gspca: do not resubmit URBs when streaming has stopped |
| |
| [ Upstream commit e6f8bd59c28f758feea403a70d6c3ef28c50959f ] |
| |
| When streaming is stopped all URBs are killed, but in fill_frame and in |
| bulk_irq this results in an attempt to resubmit the killed URB. That is |
| not what you want and causes spurious kernel messages. |
| |
| So check if streaming has stopped before resubmitting. |
| |
| Also check against gspca_dev->streaming rather than vb2_start_streaming_called() |
| since vb2_start_streaming_called() will return true when in stop_streaming, |
| but gspca_dev->streaming is set to false when stop_streaming is called. |
| |
| Fixes: 6992effe5344 ("gspca: Kill all URBs before releasing any of them") |
| |
| Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> |
| Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/media/usb/gspca/gspca.c | 8 ++++++-- |
| 1 file changed, 6 insertions(+), 2 deletions(-) |
| |
| diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c |
| index 128935f2a217e..4d7517411cc2d 100644 |
| --- a/drivers/media/usb/gspca/gspca.c |
| +++ b/drivers/media/usb/gspca/gspca.c |
| @@ -314,6 +314,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, |
| } |
| |
| resubmit: |
| + if (!gspca_dev->streaming) |
| + return; |
| /* resubmit the URB */ |
| st = usb_submit_urb(urb, GFP_ATOMIC); |
| if (st < 0) |
| @@ -330,7 +332,7 @@ static void isoc_irq(struct urb *urb) |
| struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; |
| |
| gspca_dbg(gspca_dev, D_PACK, "isoc irq\n"); |
| - if (!vb2_start_streaming_called(&gspca_dev->queue)) |
| + if (!gspca_dev->streaming) |
| return; |
| fill_frame(gspca_dev, urb); |
| } |
| @@ -344,7 +346,7 @@ static void bulk_irq(struct urb *urb) |
| int st; |
| |
| gspca_dbg(gspca_dev, D_PACK, "bulk irq\n"); |
| - if (!vb2_start_streaming_called(&gspca_dev->queue)) |
| + if (!gspca_dev->streaming) |
| return; |
| switch (urb->status) { |
| case 0: |
| @@ -367,6 +369,8 @@ static void bulk_irq(struct urb *urb) |
| urb->actual_length); |
| |
| resubmit: |
| + if (!gspca_dev->streaming) |
| + return; |
| /* resubmit the URB */ |
| if (gspca_dev->cam.bulk_nurbs != 0) { |
| st = usb_submit_urb(urb, GFP_ATOMIC); |
| -- |
| 2.20.1 |
| |