summary refs log tree commit diff
path: root/drivers/nfc
diff options
context:
space:
mode:
authorMichael Thalmeier <michael.thalmeier@hale.at>2016-04-21 16:43:53 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2016-05-10 00:01:47 +0200
commitb31d5103c33280738188c51e226224dff4401c7b (patch)
treed392fab1f463a7b33bd835d9b1d03791c90d0bf3 /drivers/nfc
parentc952f915ce8567120ffdf12998ad0c945fbc93ac (diff)
downloadlinux-b31d5103c33280738188c51e226224dff4401c7b.tar.gz
NFC: pn533: handle interrupted commands in pn533_recv_frame
When pn533_recv_frame is called from within abort_command
context the current  dev->cmd is not guaranteed to be set.

Additionally on receiving an error status we can omit frame
checking and simply schedule the workqueue.

Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/pn533/pn533.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
index 745181ea693b..d9c55830b2b2 100644
--- a/drivers/nfc/pn533/pn533.c
+++ b/drivers/nfc/pn533/pn533.c
@@ -2016,8 +2016,16 @@ _error:
  */
 void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status)
 {
+	if (!dev->cmd)
+		goto sched_wq;
+
 	dev->cmd->status = status;
 
+	if (status != 0) {
+		dev_dbg(dev->dev, "%s: Error received: %d\n", __func__, status);
+		goto sched_wq;
+	}
+
 	if (skb == NULL) {
 		pr_err("NULL Frame -> link is dead\n");
 		goto sched_wq;