Skip to contentSkip to conversation

usb: gadget: f_midi: check for error on usb_ep_queue

PATCH In review [email protected] 3 participants 4 messages Sep 18, 2015 – Sep 22, 2015 USB

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 usb: gadget: f_midi: check for error on usb_ep_queue

From: "Felipe F. Tonello" <[email protected]>

f_midi is not checking whether there is an error on usb_ep_queue request, ignoring potential problems, such as memory leaks.

---

Changes for v2:
- Update code style.

Changes for v3:
- Use ip_ep instead of out_ep. Fixed typo in commit message.

 drivers/usb/gadget/function/f_midi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_midi.c +9 -3
index ad50a67..edb84ca 100644
@@ -543,10 +543,16 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req)
 		}
 	}
 
-	if (req->length > 0)
-		usb_ep_queue(ep, req, GFP_ATOMIC);
-	else
+	if (req->length > 0) {
+		int err;
+
+		err = usb_ep_queue(ep, req, GFP_ATOMIC);
+		if (err < 0)
+			ERROR(midi, "%s queue req: %d\n",
+			      midi->in_ep->name, err);
+	} else {
 		free_ep_req(ep, req);
+	}
 }
 
 static void f_midi_in_tasklet(unsigned long data)
Signature · 1 line
2.1.4
#1 lore raw

Hi Balbi,

Quoted 5 lines · On Fri, Sep 18, 2015 at 6:36 PM, <[email protected]> wrote:

From: "Felipe F. Tonello" <[email protected]>

f_midi is not checking whether there is an error on usb_ep_queue request, ignoring potential problems, such as memory leaks.

Quoted 8 lines

---

Changes for v2:
- Update code style.

Changes for v3:
- Use ip_ep instead of out_ep. Fixed typo in commit message.

I forgot to add v3 to the patch subject, so it queued here instead. Do you want me to re-send as v3?

Felipe Tonello

#2 lore raw

Hi,

Quoted 11 lines · Felipe Tonello

Hi Balbi,

Quoted 8 lines · On Fri, Sep 18, 2015 at 6:36 PM, <[email protected]> wrote:

From: "Felipe F. Tonello" <[email protected]>

f_midi is not checking whether there is an error on usb_ep_queue request, ignoring potential problems, such as memory leaks.

---

Quoted 8 lines
Quoted 5 lines

Changes for v2:
- Update code style.

Changes for v3:
- Use ip_ep instead of out_ep. Fixed typo in commit message.

I forgot to add v3 to the patch subject, so it queued here instead. Do you want me to re-send as v3?

you need to ask Peter, he's the chipidea maintainer. Peter ?

Signature · 1 line
balbi
#3 lore raw
Quoted 17 lines · Felipe Balbi

Hi,

Quoted 14 lines · Felipe Tonello

Hi Balbi,

Quoted 11 lines · On Fri, Sep 18, 2015 at 6:36 PM, <[email protected]> wrote:

From: "Felipe F. Tonello" <[email protected]>

f_midi is not checking whether there is an error on usb_ep_queue request, ignoring potential problems, such as memory leaks.

---

Changes for v2:
- Update code style.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Changes for v3:
- Use ip_ep instead of out_ep. Fixed typo in commit message.

I forgot to add v3 to the patch subject, so it queued here instead. Do you want me to re-send as v3?

you need to ask Peter, he's the chipidea maintainer. Peter ?

I have queued the first two for chipidea changes, the third one is for gadget change.

Signature · 2 lines
Best Regards,
Peter Chen