Skip to contentSkip to conversation

UVC: use GFP_ATOMIC under spin lock.

PATCH In review Cyril Roelandt 4 participants 6 messages Nov 19, 2012 – Nov 27, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UVC: use GFP_ATOMIC under spin lock.

Found using the following semantic patch:
<spml>
@@
@@
spin_lock_irqsave(...);
... when != spin_unlock_irqrestore(...);
* GFP_KERNEL
</spml>

---
 drivers/usb/gadget/uvc_video.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/uvc_video.c +1 -1
index b0e53a8..79b4132 100644
@@ -309,7 +309,7 @@ uvc_video_pump(struct uvc_video *video)
 		video->encode(req, video, buf);
 
 		/* Queue the USB request */
-		if ((ret = usb_ep_queue(video->ep, req, GFP_KERNEL)) < 0) {
+		if ((ret = usb_ep_queue(video->ep, req, GFP_ATOMIC)) < 0) {
 			printk(KERN_INFO "Failed to queue request (%d)\n", ret);
 			usb_ep_set_halt(video->ep);
 			spin_unlock_irqrestore(&video->queue.irqlock, flags);
Signature · 1 line
1.7.10.4
#1 lore raw

Am 19.11.2012 22:34, schrieb Cyril Roelandt:

Quoted 19 lines

Found using the following semantic patch:
<spml>
@@
@@
spin_lock_irqsave(...);
... when != spin_unlock_irqrestore(...);
* GFP_KERNEL
</spml>

---
 drivers/usb/gadget/uvc_video.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/uvc_video.c +0 -0
index b0e53a8..79b4132 100644

drivers/usb/gadget/uvc_video.c uvc_video_pump(struct uvc_video *video) · line 315

Quoted 8 lines
drivers/usb/gadget/uvc_video.c +1 -1
@@ -309,7 +309,7 @@ uvc_video_pump(struct uvc_video *video)
 		video->encode(req, video, buf);
 
 		/* Queue the USB request */
-		if ((ret = usb_ep_queue(video->ep, req, GFP_KERNEL)) < 0) {
+		if ((ret = usb_ep_queue(video->ep, req, GFP_ATOMIC)) < 0) {
 			printk(KERN_INFO "Failed to queue request (%d)\n", ret);
 			usb_ep_set_halt(video->ep);
 			spin_unlock_irqrestore(&video->queue.irqlock, flags);

IMHO, this should be two lines, aka:

ret = usb_ep_queue(video->ep, req, GFP_KERNEL);
if (ret<0)

just my two cents,

re,
wh

#2 lore raw
Quoted 34 lines · walter harms

Am 19.11.2012 22:34, schrieb Cyril Roelandt:

Quoted 19 lines

Found using the following semantic patch:
<spml>
@@
@@
spin_lock_irqsave(...);
... when != spin_unlock_irqrestore(...);
* GFP_KERNEL
</spml>

---
 drivers/usb/gadget/uvc_video.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/uvc_video.c +0 -0
index b0e53a8..79b4132 100644

drivers/usb/gadget/uvc_video.c uvc_video_pump(struct uvc_video *video) · line 315

Quoted 8 lines
drivers/usb/gadget/uvc_video.c +1 -1
@@ -309,7 +309,7 @@ uvc_video_pump(struct uvc_video *video)
 		video->encode(req, video, buf);
 
 		/* Queue the USB request */
-		if ((ret = usb_ep_queue(video->ep, req, GFP_KERNEL)) < 0) {
+		if ((ret = usb_ep_queue(video->ep, req, GFP_ATOMIC)) < 0) {
 			printk(KERN_INFO "Failed to queue request (%d)\n", ret);
 			usb_ep_set_halt(video->ep);
 			spin_unlock_irqrestore(&video->queue.irqlock, flags);

IMHO, this should be two lines, aka:

Quoted 2 lines

ret = usb_ep_queue(video->ep, req, GFP_KERNEL);
if (ret<0)

correct, please resend with the fix.

Signature · 1 line
balbi
#3 lore raw
Quoted 36 lines · On Thursday 22 November 2012 14:22:23 Felipe Balbi wrote:
Quoted 35 lines · walter harms

Am 19.11.2012 22:34, schrieb Cyril Roelandt:

Quoted 28 lines

Found using the following semantic patch:
<spml>
@@
@@
spin_lock_irqsave(...);
... when != spin_unlock_irqrestore(...);
* GFP_KERNEL
</spml>

---

 drivers/usb/gadget/uvc_video.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/uvc_video.c index b0e53a8..79b4132 100644

drivers/usb/gadget/uvc_video.c +1 -1
@@ -309,7 +309,7 @@ uvc_video_pump(struct uvc_video *video)
 
 		video->encode(req, video, buf);
 
 		/* Queue the USB request */
 
-		if ((ret = usb_ep_queue(video->ep, req, GFP_KERNEL)) < 0) {
+		if ((ret = usb_ep_queue(video->ep, req, GFP_ATOMIC)) < 0) {
 

drivers/usb/gadget/uvc_video.c uvc_video_pump(struct uvc_video *video) · line 315

Quoted 3 lines
drivers/usb/gadget/uvc_video.c +0 -0
 			printk(KERN_INFO "Failed to queue request (%d)\n", ret);
 			usb_ep_set_halt(video->ep);
 			spin_unlock_irqrestore(&video->queue.irqlock, flags);

IMHO, this should be two lines, aka:

Quoted 4 lines
Quoted 2 lines

ret = usb_ep_queue(video->ep, req, GFP_KERNEL);
if (ret<0)

correct, please resend with the fix.

I agree as well.

Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

PATCH v2 1/1 UVC: use GFP_ATOMIC under spin lock.

In reply to walter harms

Found using the following semantic patch:
<spml>
@@
@@
spin_lock_irqsave(...);
... when != spin_unlock_irqrestore(...);
* GFP_KERNEL
</spml>

---
 drivers/usb/gadget/uvc_video.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/uvc_video.c +2 -1
index b0e53a8..cd067a6 100644
@@ -309,7 +309,8 @@ uvc_video_pump(struct uvc_video *video)
 		video->encode(req, video, buf);
 
 		/* Queue the USB request */
-		if ((ret = usb_ep_queue(video->ep, req, GFP_KERNEL)) < 0) {
+		ret = usb_ep_queue(video->ep, req, GFP_ATOMIC);
+		if (ret < 0) {
 			printk(KERN_INFO "Failed to queue request (%d)\n", ret);
 			usb_ep_set_halt(video->ep);
 			spin_unlock_irqrestore(&video->queue.irqlock, flags);
Signature · 1 line
1.7.10.4
Acked-by on v2 1/1
#5 lore raw

Hi Cyril,

Thank you for the patch.

Quoted 10 lines · On Sunday 25 November 2012 02:58:19 Cyril Roelandt wrote:

Found using the following semantic patch:
<spml>
@@
@@
spin_lock_irqsave(...);
... when != spin_unlock_irqrestore(...);
* GFP_KERNEL
</spml>

and applied to my tree

Quoted 18 lines
---
 drivers/usb/gadget/uvc_video.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/uvc_video.c +2 -1
index b0e53a8..cd067a6 100644
@@ -309,7 +309,8 @@ uvc_video_pump(struct uvc_video *video)
 		video->encode(req, video, buf);
 
 		/* Queue the USB request */
-		if ((ret = usb_ep_queue(video->ep, req, GFP_KERNEL)) < 0) {
+		ret = usb_ep_queue(video->ep, req, GFP_ATOMIC);
+		if (ret < 0) {
 			printk(KERN_INFO "Failed to queue request (%d)\n", ret);
 			usb_ep_set_halt(video->ep);
 			spin_unlock_irqrestore(&video->queue.irqlock, flags);
Signature · 3 lines
Regards,

Laurent Pinchart