summaryrefslogtreecommitdiff
path: root/drivers/nfc
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2012-10-11 14:03:58 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-10-26 18:26:51 +0200
commit82dec34df64620a0e06ea6f7020092e41244c3c2 (patch)
tree403251c743a2fa85d3d124e285cfce3b6b11c813 /drivers/nfc
parenta8df0f379213f190eff5f1cfe6b9f81475068d20 (diff)
downloadlinux-3.10-82dec34df64620a0e06ea6f7020092e41244c3c2.tar.gz
linux-3.10-82dec34df64620a0e06ea6f7020092e41244c3c2.tar.bz2
linux-3.10-82dec34df64620a0e06ea6f7020092e41244c3c2.zip
NFC: pn533: Fix in/out frame buffer allocation
Max frame size should be 264 bytes as per spec and not limited to endpoint MaxPacketSize which is 64 in my case (acr122 reader). Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/pn533.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 97c440a8cd6..f563cac02f3 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -84,6 +84,10 @@ MODULE_DEVICE_TABLE(usb, pn533_table);
#define PN533_LISTEN_TIME 2
/* frame definitions */
+#define PN533_NORMAL_FRAME_MAX_LEN 262 /* 6 (PREAMBLE, SOF, LEN, LCS, TFI)
+ 254 (DATA)
+ 2 (DCS, postamble) */
+
#define PN533_FRAME_TAIL_SIZE 2
#define PN533_FRAME_SIZE(f) (sizeof(struct pn533_frame) + f->datalen + \
PN533_FRAME_TAIL_SIZE)
@@ -2373,9 +2377,9 @@ static int pn533_probe(struct usb_interface *interface,
goto error;
}
- dev->in_frame = kmalloc(dev->in_maxlen, GFP_KERNEL);
+ dev->in_frame = kmalloc(PN533_NORMAL_FRAME_MAX_LEN, GFP_KERNEL);
dev->in_urb = usb_alloc_urb(0, GFP_KERNEL);
- dev->out_frame = kmalloc(dev->out_maxlen, GFP_KERNEL);
+ dev->out_frame = kmalloc(PN533_NORMAL_FRAME_MAX_LEN, GFP_KERNEL);
dev->out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->in_frame || !dev->out_frame ||