* [PATCH] media: dvb-frontends: clean the freed pointer and counter
@ 2021-08-14 9:40 Nil Yi
0 siblings, 0 replies; only message in thread
From: Nil Yi @ 2021-08-14 9:40 UTC (permalink / raw)
To: crope, linux-media; +Cc: sean
After freed the dev->urb_list, we should set it to NULL as well as set
counter to zero.
Signed-off-by: Nil Yi <teroincn@163.com>
Asked-by: Sean Young <sean@mess.org>
---
drivers/media/dvb-frontends/rtl2832_sdr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c
index 1a2f0d2ad..6a4f2997d 100644
--- a/drivers/media/dvb-frontends/rtl2832_sdr.c
+++ b/drivers/media/dvb-frontends/rtl2832_sdr.c
@@ -376,8 +376,11 @@ static int rtl2832_sdr_alloc_urbs(struct rtl2832_sdr_dev *dev)
dev_dbg(&pdev->dev, "alloc urb=%d\n", i);
dev->urb_list[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->urb_list[i]) {
- for (j = 0; j < i; j++)
+ for (j = 0; j < i; j++) {
usb_free_urb(dev->urb_list[j]);
+ dev->urb_list[j] = NULL;
+ }
+ dev->urbs_initialized = 0;
return -ENOMEM;
}
usb_fill_bulk_urb(dev->urb_list[i],
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-14 9:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-14 9:40 [PATCH] media: dvb-frontends: clean the freed pointer and counter Nil Yi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox