* [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()'
@ 2019-07-31 12:51 Christophe JAILLET
2019-07-31 12:51 ` [PATCH 1/2] usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()' Christophe JAILLET
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2019-07-31 12:51 UTC (permalink / raw)
To: mathias.nyman, gregkh
Cc: linux-usb, linux-kernel, kernel-janitors, Christophe JAILLET
Christophe JAILLET (2):
usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()'
usb: xhci: dbc: Use GFP_KERNEL instead of GFP_ATOMIC in
'xhci_dbc_alloc_requests()'
drivers/usb/host/xhci-dbgtty.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()'
2019-07-31 12:51 [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()' Christophe JAILLET
@ 2019-07-31 12:51 ` Christophe JAILLET
2019-07-31 12:52 ` [PATCH 2/2] usb: xhci: dbc: Use GFP_KERNEL instead of GFP_ATOMIC " Christophe JAILLET
2019-08-05 10:43 ` [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()' Mathias Nyman
2 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2019-07-31 12:51 UTC (permalink / raw)
To: mathias.nyman, gregkh
Cc: linux-usb, linux-kernel, kernel-janitors, Christophe JAILLET
If the 'kmalloc()' fails, we need to undo the previous
'dbc_alloc_request()' call.
Because of the more similar function name, it is more logical to use
'dbc_free_request()' instead of 'xhci_dbc_free_req()'.
Both are equivalent here because:
static void xhci_dbc_free_req(struct dbc_ep *dep, struct dbc_request *req)
{
kfree(req->buf);
dbc_free_request(dep, req);
}
and 'req->buf' is known to be NULL at this point
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/usb/host/xhci-dbgtty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index aff79ff5aba4..845939f8a0b8 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -146,7 +146,7 @@ xhci_dbc_alloc_requests(struct dbc_ep *dep, struct list_head *head,
req->length = DBC_MAX_PACKET;
req->buf = kmalloc(req->length, GFP_KERNEL);
if (!req->buf) {
- xhci_dbc_free_req(dep, req);
+ dbc_free_request(dep, req);
break;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] usb: xhci: dbc: Use GFP_KERNEL instead of GFP_ATOMIC in 'xhci_dbc_alloc_requests()'
2019-07-31 12:51 [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()' Christophe JAILLET
2019-07-31 12:51 ` [PATCH 1/2] usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()' Christophe JAILLET
@ 2019-07-31 12:52 ` Christophe JAILLET
2019-08-05 10:43 ` [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()' Mathias Nyman
2 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2019-07-31 12:52 UTC (permalink / raw)
To: mathias.nyman, gregkh
Cc: linux-usb, linux-kernel, kernel-janitors, Christophe JAILLET
There is no need to use GFP_ATOMIC to allocate 'req'. GFP_KERNEL should be
enough and is already used for another allocation juste a few lines below.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
I've done my best to check if a spinlock can be hold when reaching this
code. Apparently it is never the case.
But double check to be sure that it is not the kmalloc that should use
GFP_ATOMIC.
---
drivers/usb/host/xhci-dbgtty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index 845939f8a0b8..be726c791323 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -139,7 +139,7 @@ xhci_dbc_alloc_requests(struct dbc_ep *dep, struct list_head *head,
struct dbc_request *req;
for (i = 0; i < DBC_QUEUE_SIZE; i++) {
- req = dbc_alloc_request(dep, GFP_ATOMIC);
+ req = dbc_alloc_request(dep, GFP_KERNEL);
if (!req)
break;
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()'
2019-07-31 12:51 [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()' Christophe JAILLET
2019-07-31 12:51 ` [PATCH 1/2] usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()' Christophe JAILLET
2019-07-31 12:52 ` [PATCH 2/2] usb: xhci: dbc: Use GFP_KERNEL instead of GFP_ATOMIC " Christophe JAILLET
@ 2019-08-05 10:43 ` Mathias Nyman
2 siblings, 0 replies; 4+ messages in thread
From: Mathias Nyman @ 2019-08-05 10:43 UTC (permalink / raw)
To: Christophe JAILLET, mathias.nyman, gregkh
Cc: linux-usb, linux-kernel, kernel-janitors
On 31.7.2019 15.51, Christophe JAILLET wrote:
>
>
> Christophe JAILLET (2):
> usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()'
> usb: xhci: dbc: Use GFP_KERNEL instead of GFP_ATOMIC in
> 'xhci_dbc_alloc_requests()'
>
> drivers/usb/host/xhci-dbgtty.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Thanks, adding to queue
-Mathias
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-05 10:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 12:51 [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()' Christophe JAILLET
2019-07-31 12:51 ` [PATCH 1/2] usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()' Christophe JAILLET
2019-07-31 12:52 ` [PATCH 2/2] usb: xhci: dbc: Use GFP_KERNEL instead of GFP_ATOMIC " Christophe JAILLET
2019-08-05 10:43 ` [PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()' Mathias Nyman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).