[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1461249839-16962-6-git-send-email-michael.thalmeier@hale.at>
Date:	Thu, 21 Apr 2016 16:43:53 +0200
From:	Michael Thalmeier <michael.thalmeier@...e.at>
To:	Samuel Ortiz <sameo@...ux.intel.com>
Cc:	Lauro Ramos Venancio <lauro.venancio@...nbossa.org>,
	Aloisio Almeida Jr <aloisio.almeida@...nbossa.org>,
	linux-kernel@...r.kernel.org, linux-nfc@...ts.01.org,
	michael@...lmeier.at
Subject: [PATCH 05/11] 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 workquueue.
Signed-off-by: Michael Thalmeier <michael.thalmeier@...e.at>
---
 drivers/nfc/pn533/pn533.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
index 745181e..d9c5583 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;
-- 
2.5.5
Powered by blists - more mailing lists
 
