summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorNil Yi <teroincn@163.com>2021-08-15 11:49:23 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-09-30 10:07:54 +0200
commita9be3931188f240aa2dbdb7c9af65ecfb8c073c1 (patch)
tree3bd52a057cbc24fa241f5f8cb85136df4d21178b /drivers
parent48d219f9cc667bc6fbc3e3af0b1bfd75db94fce4 (diff)
downloadlinux-a9be3931188f240aa2dbdb7c9af65ecfb8c073c1.tar.gz
media: usb: airspy: clean the freed pointer and counter
After urb was freed, the pointer and counter need to be
cleaned.

Signed-off-by: Nil Yi <teroincn@163.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/usb/airspy/airspy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
index 7a81be7970b2..d568452618d1 100644
--- a/drivers/media/usb/airspy/airspy.c
+++ b/drivers/media/usb/airspy/airspy.c
@@ -415,8 +415,11 @@ static int airspy_alloc_urbs(struct airspy *s)
 		dev_dbg(s->dev, "alloc urb=%d\n", i);
 		s->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC);
 		if (!s->urb_list[i]) {
-			for (j = 0; j < i; j++)
+			for (j = 0; j < i; j++) {
 				usb_free_urb(s->urb_list[j]);
+				s->urb_list[j] = NULL;
+			}
+			s->urbs_initialized = 0;
 			return -ENOMEM;
 		}
 		usb_fill_bulk_urb(s->urb_list[i],