summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2013-04-03 06:02:00 (GMT)
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-11 14:29:00 (GMT)
commit95cb9e10239583a8a849cdbaec689b139618319a (patch)
treeb0fde17e3a91db166b64527a98421bc4a6f20c99
parenta45e1c8d17c04b8fbb27818ce3454d889696da08 (diff)
downloadlinux-95cb9e10239583a8a849cdbaec689b139618319a.tar.xz
NFC: pn533: Fix div by zero while stopping polling
Depends on timing division by zero can happen when user stops polling. pn533_stop_poll() resets modulation counter on stop_poll, but meanwhile we get response for last poll request and try, despite of stop poll request, to schedule next modulation for polling. Log message: [345.922515] pn533 1-1.3:1.0: pn533_stop_poll [345.928314] pn533 1-1.3:1.0: pn533_send_ack [345.932769] pn533 1-1.3:1.0: Received a frame. [345.937438] PN533 RX: 00 00 ff 03 fd d5 4b 00 e0 00 [345.942840] pn533 1-1.3:1.0: pn533_poll_complete [345.947753] pn533 1-1.3:1.0: pn533_start_poll_complete [345.953186] Division by zero in kernel. [345.957244] [<c001b38c>] (unwind_backtrace+0x0/0xf0) [345.965698] [<c0260e78>] (Ldiv0+0x8/0x10) [345.974060] [<c0260e60>] (__aeabi_idivmod+0x8/0x18) [345.983978] [<c02e0064>] (pn533_poll_complete+0x3c0/0x500) [345.994903] [<c02df690>] (pn533_send_async_complete+0x7c/0xc0) [346.005828] [<c02e028c>] (pn533_wq_cmd_complete+0x1c/0x34) [346.016113] [<c005d134>] (process_one_work+0x1ac/0x57c) [346.025848] [<c005d85c>] (worker_thread+0x168/0x42c) [346.034576] [<c00620c0>] (kthread+0xa4/0xb0) Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/pn533.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 8ee032d..c20778a 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -1550,6 +1550,11 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg,
if (!rc)
goto done;
+ if (!dev->poll_mod_count) {
+ nfc_dev_dbg(&dev->interface->dev, "Polling has been stoped.");
+ goto done;
+ }
+
pn533_poll_next_mod(dev);
queue_work(dev->wq, &dev->poll_work);