diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2018-07-30 05:33:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-08-02 19:16:17 -0400 |
commit | 2c3449fb95c318920ca8dc645d918d408db219ac (patch) | |
tree | 50c6ab7f8534f3e1eaaf1370415b35c089522caa /drivers/media/usb/hackrf/hackrf.c | |
parent | 7a3369e8a78538e813e96294b8c7fce9feb76e0f (diff) |
media: usb: hackrf: Replace GFP_ATOMIC with GFP_KERNEL
hackrf_submit_urbs(), hackrf_alloc_stream_bufs() and hackrf_alloc_urbs()
are never called in atomic context.
They call usb_submit_urb(), usb_alloc_coherent() and usb_alloc_urb()
with GFP_ATOMIC, which is not necessary.
GFP_ATOMIC can be replaced with GFP_KERNEL.
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/usb/hackrf/hackrf.c')
-rw-r--r-- | drivers/media/usb/hackrf/hackrf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 6d692fb3e8dd..34085a0b15a1 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c | |||
@@ -597,7 +597,7 @@ static int hackrf_submit_urbs(struct hackrf_dev *dev) | |||
597 | 597 | ||
598 | for (i = 0; i < dev->urbs_initialized; i++) { | 598 | for (i = 0; i < dev->urbs_initialized; i++) { |
599 | dev_dbg(dev->dev, "submit urb=%d\n", i); | 599 | dev_dbg(dev->dev, "submit urb=%d\n", i); |
600 | ret = usb_submit_urb(dev->urb_list[i], GFP_ATOMIC); | 600 | ret = usb_submit_urb(dev->urb_list[i], GFP_KERNEL); |
601 | if (ret) { | 601 | if (ret) { |
602 | dev_err(dev->dev, "Could not submit URB no. %d - get them all back\n", | 602 | dev_err(dev->dev, "Could not submit URB no. %d - get them all back\n", |
603 | i); | 603 | i); |
@@ -636,7 +636,7 @@ static int hackrf_alloc_stream_bufs(struct hackrf_dev *dev) | |||
636 | 636 | ||
637 | for (dev->buf_num = 0; dev->buf_num < MAX_BULK_BUFS; dev->buf_num++) { | 637 | for (dev->buf_num = 0; dev->buf_num < MAX_BULK_BUFS; dev->buf_num++) { |
638 | dev->buf_list[dev->buf_num] = usb_alloc_coherent(dev->udev, | 638 | dev->buf_list[dev->buf_num] = usb_alloc_coherent(dev->udev, |
639 | BULK_BUFFER_SIZE, GFP_ATOMIC, | 639 | BULK_BUFFER_SIZE, GFP_KERNEL, |
640 | &dev->dma_addr[dev->buf_num]); | 640 | &dev->dma_addr[dev->buf_num]); |
641 | if (!dev->buf_list[dev->buf_num]) { | 641 | if (!dev->buf_list[dev->buf_num]) { |
642 | dev_dbg(dev->dev, "alloc buf=%d failed\n", | 642 | dev_dbg(dev->dev, "alloc buf=%d failed\n", |
@@ -689,7 +689,7 @@ static int hackrf_alloc_urbs(struct hackrf_dev *dev, bool rcv) | |||
689 | /* allocate the URBs */ | 689 | /* allocate the URBs */ |
690 | for (i = 0; i < MAX_BULK_BUFS; i++) { | 690 | for (i = 0; i < MAX_BULK_BUFS; i++) { |
691 | dev_dbg(dev->dev, "alloc urb=%d\n", i); | 691 | dev_dbg(dev->dev, "alloc urb=%d\n", i); |
692 | dev->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); | 692 | dev->urb_list[i] = usb_alloc_urb(0, GFP_KERNEL); |
693 | if (!dev->urb_list[i]) { | 693 | if (!dev->urb_list[i]) { |
694 | for (j = 0; j < i; j++) | 694 | for (j = 0; j < i; j++) |
695 | usb_free_urb(dev->urb_list[j]); | 695 | usb_free_urb(dev->urb_list[j]); |