Re: [PATCH] HID: usbhid: Use GFP_KERNEL instead of GFP_ATOMIC when applicable

2019-08-02 Thread Christophe JAILLET
Hi, (and sorry if you receive this email twice. I've used a web mail which sends HTML by default and it was rejected by ML) Le 01/08/2019 à 12:06, walter harms a écrit : Am 01.08.2019 09:47, schrieb Christophe JAILLET: There is no need to use GFP_ATOMIC when calling 'usb_allo

[PATCH] HID: usbhid: Use GFP_KERNEL instead of GFP_ATOMIC when applicable

2019-08-01 Thread Christophe JAILLET
There is no need to use GFP_ATOMIC when calling 'usb_alloc_coherent()' here. These calls are done from probe functions and using GFP_KERNEL should be safe. The memory itself is used within some interrupts, but it is not a problem, once it has been allocated. Signed-off-by: Christop

[PATCH 1/2] usb: xhci: dbc: Simplify error handling in 'xhci_dbc_alloc_requests()'

2019-07-31 Thread Christophe JAILLET
oid 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 --- drivers/usb/host/xhci-dbgtty.c | 2 +- 1 file changed, 1 inserti

[PATCH 2/2] usb: xhci: dbc: Use GFP_KERNEL instead of GFP_ATOMIC in 'xhci_dbc_alloc_requests()'

2019-07-31 Thread 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 --- I've done my best to check if a spinlock can be hold when reaching this code. Apparently

[PATCH 0/2] usb: xhci: dbc: 2 smalll fixes for 'xhci_dbc_alloc_requests()'

2019-07-31 Thread 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

[PATCH 2/4] usb: gadget: fotg210-udc: Fix a memory leak

2018-01-12 Thread Christophe JAILLET
The memory referenced by the 'fotg210->ep[]' array, is never freed. So there is a memory leak in the error handling path of the probe function and when the driver is unloaded. Use 'devm_kzalloc()' to fix these leaks. Signed-off-by: Christophe JAILLET --- drivers/usb/gadge

[PATCH 1/4] usb: gadget: fotg210-udc: Remove a useless

2018-01-12 Thread Christophe JAILLET
There is no need to use an intermediate array for these memory allocations, so, axe it. While at it, turn a '== NULL' into a shorter '!' when testing memory allocation failure. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/udc/fotg210-udc.c | 6 ++ 1 file c

[PATCH 3/4] usb: gadget: fotg210-udc: Simplify code

2018-01-12 Thread Christophe JAILLET
Use 'devm_kzalloc()' and 'devm_ioremap()' to simplify code. While at it, turn some '== NULL' into shorter '!' when testing memory allocation failure. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/udc/fotg210-udc.c | 25 --

[PATCH 4/4] usb: gadget: fotg210-udc: Fix a potential invalid pointer dereference

2018-01-12 Thread Christophe JAILLET
pportunity to further simplify code. (In fact, this change should be a no-op, because 'req' is the first field of 'struct fotg210_request'. So passing NULL would result in 'free(NULL)' in 'fotg210_ep_free_request()'. Anyway avoiding the goto is cleaner.)

[PATCH 0/4] usb: gadget: fotg210-udc: Fixes and cleanup

2018-01-12 Thread Christophe JAILLET
evm_ function to simplify code. I've left the request_irq/free_irq because I'm unsure of potential side effects if some other resources are freed while an IRQ can still be triggered. So I've preferred to leave it as-is. Christophe JAILLET (4): usb: gadget: fotg210-udc: Remove a us

[PATCH] usb: chipidea: usb2: check memory allocation failure

2017-08-24 Thread Christophe JAILLET
Check memory allocation failure and return -ENOMEM in such a case, as already done few lines below for another memory allocation. Signed-off-by: Christophe JAILLET --- drivers/usb/chipidea/ci_hdrc_usb2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c

[PATCH] USB: gadgetfs: Fix a potential memory leak in 'dev_config()'

2017-02-21 Thread Christophe JAILLET
'kbuf' is allocated just a few lines above using 'memdup_user()'. If the 'if (dev->buf)' test fails, this memory is never released. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/legacy/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH] usb: gadget: composite: Fix function used to free memory

2017-01-03 Thread Christophe JAILLET
'cdev->os_desc_req' has been allocated with 'usb_ep_alloc_request()' so 'usb_ep_free_request()' should be used to free it. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH] usb: dwc3: Fix size used in dma_free_coherent()

2016-10-07 Thread Christophe JAILLET
WARNING: sizes look different: '%s' vs '%s'" % (y0, y1) Fixes: 2abd9d5fa60f9 ("usb: dwc3: ep0: Add chained TRB support") Signed-off-by: Christophe JAILLET --- Untested --- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insert

Re: [PATCH] usb: gadget: composite: Fix function used to free memory

2016-07-16 Thread Christophe JAILLET
Apologies, this one has been sent by error. It is the same as: [PATCH 2/2] usb: gadget: composite: Fix function used to free memory sent a couple of minutes before. Best regards, CJ Le 16/07/2016 à 08:57, Christophe JAILLET a écrit : 'cdev->os_desc_req' has been a

[PATCH] usb: gadget: uvc: Fix return value in case of error

2016-07-16 Thread Christophe JAILLET
If this memory allocation fail, we will return 0, which means success. Return -ENOMEM instead. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/function/uvc_configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/uvc_configfs.c b

[PATCH] usb: gadget: composite: Fix function used to free memory

2016-07-15 Thread Christophe JAILLET
'cdev->os_desc_req' has been allocated with 'usb_ep_alloc_request' so 'usb_ep_free_request' should be used to free it. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH 2/2] usb: gadget: composite: Fix function used to free memory

2016-07-15 Thread Christophe JAILLET
'cdev->os_desc_req' has been allocated with 'usb_ep_alloc_request' so 'usb_ep_free_request' should be used to free it. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH 1/2] usb: gadget: composite: Fix return value in case of error

2016-07-15 Thread Christophe JAILLET
In 'composite_os_desc_req_prepare', if one of the memory allocations fail, 0 will be returned, which means success. We should return -ENOMEM instead. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/composite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) di