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>
This commit is contained in:
Michael Thalmeier 2016-04-21 16:43:53 +02:00 committed by Samuel Ortiz
parent c952f915ce
commit b31d5103c3
1 changed files with 8 additions and 0 deletions

View File

@ -2016,8 +2016,16 @@ _error:
*/ */
void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status) void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status)
{ {
if (!dev->cmd)
goto sched_wq;
dev->cmd->status = status; dev->cmd->status = status;
if (status != 0) {
dev_dbg(dev->dev, "%s: Error received: %d\n", __func__, status);
goto sched_wq;
}
if (skb == NULL) { if (skb == NULL) {
pr_err("NULL Frame -> link is dead\n"); pr_err("NULL Frame -> link is dead\n");
goto sched_wq; goto sched_wq;