]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFC: pn533: handle interrupted commands in pn533_recv_frame
authorMichael Thalmeier <michael.thalmeier@hale.at>
Thu, 21 Apr 2016 14:43:53 +0000 (16:43 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 9 May 2016 22:01:47 +0000 (00:01 +0200)
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>
drivers/nfc/pn533/pn533.c

index 745181ea693b044e3ddb5a0a27f79475188e8add..d9c55830b2b26a1fb67b41562b3b16c0b09f8830 100644 (file)
@@ -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;