Skip to contentSkip to conversation

NFC: pn533: Fix wrong GFP flag usage

PATCH New Hans de Goede 1 participant 1 message Jun 7, 2018

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

PATCH v2 1/1 NFC: pn533: Fix wrong GFP flag usage

pn533_recv_response() is an urb completion handler, so it must use GFP_ATOMIC. pn533_usb_send_frame() OTOH runs from a regular sleeping context, so the pn533_submit_urb_for_response() there (and only there) can use the regular GFP_KERNEL flags.

Fixes 9815c7cf22da ("NFC: pn533: Separate physical layer from ...")
Cc Michael Thalmeier <[email protected]>

---
Changes in v2:
-Rebase on top of current usb/usb-next

---
 drivers/nfc/pn533/usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nfc/pn533/usb.c +2 -2
index d5553c47014f..5d823e965883 100644
@@ -74,7 +74,7 @@ static void pn533_recv_response(struct urb *urb)
 	struct sk_buff *skb = NULL;
 
 	if (!urb->status) {
-		skb = alloc_skb(urb->actual_length, GFP_KERNEL);
+		skb = alloc_skb(urb->actual_length, GFP_ATOMIC);
 		if (!skb) {
 			nfc_err(&phy->udev->dev, "failed to alloc memory\n");
 		} else {
@@ -186,7 +186,7 @@ static int pn533_usb_send_frame(struct pn533 *dev,
 
 	if (dev->protocol_type == PN533_PROTO_REQ_RESP) {
 		/* request for response for sent packet directly */
-		rc = pn533_submit_urb_for_response(phy, GFP_ATOMIC);
+		rc = pn533_submit_urb_for_response(phy, GFP_KERNEL);
 		if (rc)
 			goto error;
 	} else if (dev->protocol_type == PN533_PROTO_REQ_ACK_RESP) {