Skip to contentSkip to conversation

staging: vt6656: replace GFP_ATOMIC with GFP_KERNEL for urb allocation

PATCH Superseded Alison Schofield 2 participants 5 messages Feb 12, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: replace GFP_ATOMIC with GFP_KERNEL for urb allocation

Replace one instance of GFP_ATOMIC w GFP_KERNEL during urb buffer allocation. This makes vnt_alloc_bufs() consistent in setting GFP_KERNEL during kmalloc() and usb_alloc_urb(). GFP_KERNEL is safe because we are in process context, not in an intr handler, nor holding any spinlock.

---
 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -1
index 05f86ff..f7c4362 100644
@@ -439,7 +439,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 		tx_context->pkt_no = ii;
 
 		/* allocate URBs */
-		tx_context->urb = usb_alloc_urb(0, GFP_ATOMIC);
+		tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!tx_context->urb) {
 			dev_err(&priv->usb->dev, "alloc tx urb failed\n");
 			goto free_tx;
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/1 staging: vt6656: replace GFP_ATOMIC with GFP_KERNEL for urb allocation

Replace one instance of GFP_ATOMIC with GFP_KERNEL during urb buffer allocation. This makes vnt_alloc_bufs() consistent in setting GFP_KERNEL during kmalloc() and usb_alloc_urb(). GFP_KERNEL is safe because we are in process context, not in an interrupt handler, nor holding any spinlock.

---
Changes in v2:
expanded abbreviations in commit message

 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -1
index 05f86ff..f7c4362 100644
@@ -439,7 +439,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 		tx_context->pkt_no = ii;
 
 		/* allocate URBs */
-		tx_context->urb = usb_alloc_urb(0, GFP_ATOMIC);
+		tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!tx_context->urb) {
 			dev_err(&priv->usb->dev, "alloc tx urb failed\n");
 			goto free_tx;
Signature · 1 line
2.1.4
#2 lore raw
Quoted 6 lines · Alison Schofield

Replace one instance of GFP_ATOMIC with GFP_KERNEL during urb buffer allocation. This makes vnt_alloc_bufs() consistent in setting GFP_KERNEL during kmalloc() and usb_alloc_urb(). GFP_KERNEL is safe because we are in process context, not in an interrupt handler, nor holding any spinlock.

Really nice idea. While at it please also fix the allocations in the same function for priv->interrupt_urb and rcb->urb.

Quoted 29 lines

---
Changes in v2:
expanded abbreviations in commit message

 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -2
index 05f86ff..f7c4362 100644
@@ -439,7 +439,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
                tx_context->pkt_no = ii;
 
                /* allocate URBs */
-               tx_context->urb = usb_alloc_urb(0, GFP_ATOMIC);
+               tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
                if (!tx_context->urb) {
                        dev_err(&priv->usb->dev, "alloc tx urb failed\n");
                        goto free_tx;
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455262646-14649-1-git-send-email-amsfield22%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 10 lines · Daniel Baluta
Quoted 6 lines · Alison Schofield

Replace one instance of GFP_ATOMIC with GFP_KERNEL during urb buffer allocation. This makes vnt_alloc_bufs() consistent in setting GFP_KERNEL during kmalloc() and usb_alloc_urb(). GFP_KERNEL is safe because we are in process context, not in an interrupt handler, nor holding any spinlock.

Really nice idea. While at it please also fix the allocations in the same function for priv->interrupt_urb and rcb->urb.

Credit goes to Julia's eagle eye!
Sending patch update.
alison

Quoted 30 lines
Quoted 30 lines

---
Changes in v2:
expanded abbreviations in commit message

 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -2
index 05f86ff..f7c4362 100644
@@ -439,7 +439,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
                tx_context->pkt_no = ii;
 
                /* allocate URBs */
-               tx_context->urb = usb_alloc_urb(0, GFP_ATOMIC);
+               tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
                if (!tx_context->urb) {
                        dev_err(&priv->usb->dev, "alloc tx urb failed\n");
                        goto free_tx;
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455262646-14649-1-git-send-email-amsfield22%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw

PATCH v3 1/1 staging: vt6656: replace GFP_ATOMIC with GFP_KERNEL for urb allocation

In reply to Alison Schofield

Replace GFP_ATOMIC with GFP_KERNEL during urb buffer allocation. This makes vnt_alloc_bufs() consistent in setting GFP_KERNEL during kmalloc() and usb_alloc_urb(). GFP_KERNEL is safe because we are in process context, not in an interrupt handler, nor holding any spinlock.

---
Changes in v3:
- changed 2 additional instances in same function
- modified changelog
Changes in v2:
- expanded abbreviations changelog

 drivers/staging/vt6656/main_usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vt6656/main_usb.c +3 -3
index 05f86ff..f9afab7 100644
@@ -439,7 +439,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 		tx_context->pkt_no = ii;
 
 		/* allocate URBs */
-		tx_context->urb = usb_alloc_urb(0, GFP_ATOMIC);
+		tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!tx_context->urb) {
 			dev_err(&priv->usb->dev, "alloc tx urb failed\n");
 			goto free_tx;
@@ -461,7 +461,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 		rcb->priv = priv;
 
 		/* allocate URBs */
-		rcb->urb = usb_alloc_urb(0, GFP_ATOMIC);
+		rcb->urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!rcb->urb) {
 			dev_err(&priv->usb->dev, "Failed to alloc rx urb\n");
 			goto free_rx_tx;
@@ -478,7 +478,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 			goto free_rx_tx;
 	}
 
-	priv->interrupt_urb = usb_alloc_urb(0, GFP_ATOMIC);
+	priv->interrupt_urb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!priv->interrupt_urb) {
 		dev_err(&priv->usb->dev, "Failed to alloc int urb\n");
 		goto free_rx_tx;
Signature · 1 line
2.1.4