aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/pn533.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 2f39209507d4..147ad05122b3 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -334,7 +334,7 @@ struct pn533 {
334 void *cmd_complete_arg; 334 void *cmd_complete_arg;
335 void *cmd_complete_mi_arg; 335 void *cmd_complete_mi_arg;
336 struct mutex cmd_lock; 336 struct mutex cmd_lock;
337 u8 cmd; 337 struct pn533_cmd *cmd;
338 338
339 struct pn533_poll_modulations *poll_mod_active[PN533_POLL_MOD_MAX + 1]; 339 struct pn533_poll_modulations *poll_mod_active[PN533_POLL_MOD_MAX + 1];
340 u8 poll_mod_count; 340 u8 poll_mod_count;
@@ -502,7 +502,8 @@ static struct pn533_frame_ops pn533_std_frame_ops = {
502 502
503static bool pn533_rx_frame_is_cmd_response(struct pn533 *dev, void *frame) 503static bool pn533_rx_frame_is_cmd_response(struct pn533 *dev, void *frame)
504{ 504{
505 return (dev->ops->get_cmd_code(frame) == PN533_CMD_RESPONSE(dev->cmd)); 505 return (dev->ops->get_cmd_code(frame) ==
506 PN533_CMD_RESPONSE(dev->cmd->cmd_code));
506} 507}
507 508
508 509
@@ -648,7 +649,6 @@ static int __pn533_send_frame_async(struct pn533 *dev,
648{ 649{
649 int rc; 650 int rc;
650 651
651 dev->cmd = dev->ops->get_cmd_code(out->data);
652 dev->cmd_complete = cmd_complete; 652 dev->cmd_complete = cmd_complete;
653 dev->cmd_complete_arg = arg; 653 dev->cmd_complete_arg = arg;
654 654
@@ -707,8 +707,7 @@ static int pn533_send_async_complete(struct pn533 *dev, void *arg, int status)
707 rc = cmd->complete_cb(dev, cmd->complete_cb_context, 707 rc = cmd->complete_cb(dev, cmd->complete_cb_context,
708 ERR_PTR(status)); 708 ERR_PTR(status));
709 dev_kfree_skb(resp); 709 dev_kfree_skb(resp);
710 kfree(cmd); 710 goto done;
711 return rc;
712 } 711 }
713 712
714 skb_put(resp, dev->ops->rx_frame_size(resp->data)); 713 skb_put(resp, dev->ops->rx_frame_size(resp->data));
@@ -717,7 +716,9 @@ static int pn533_send_async_complete(struct pn533 *dev, void *arg, int status)
717 716
718 rc = cmd->complete_cb(dev, cmd->complete_cb_context, resp); 717 rc = cmd->complete_cb(dev, cmd->complete_cb_context, resp);
719 718
719done:
720 kfree(cmd); 720 kfree(cmd);
721 dev->cmd = NULL;
721 return rc; 722 return rc;
722} 723}
723 724
@@ -754,6 +755,7 @@ static int __pn533_send_async(struct pn533 *dev, u8 cmd_code,
754 goto error; 755 goto error;
755 756
756 dev->cmd_pending = 1; 757 dev->cmd_pending = 1;
758 dev->cmd = cmd;
757 goto unlock; 759 goto unlock;
758 } 760 }
759 761
@@ -862,6 +864,8 @@ static int pn533_send_cmd_direct_async(struct pn533 *dev, u8 cmd_code,
862 if (rc < 0) { 864 if (rc < 0) {
863 dev_kfree_skb(resp); 865 dev_kfree_skb(resp);
864 kfree(cmd); 866 kfree(cmd);
867 } else {
868 dev->cmd = cmd;
865 } 869 }
866 870
867 return rc; 871 return rc;
@@ -893,7 +897,10 @@ static void pn533_wq_cmd(struct work_struct *work)
893 dev_kfree_skb(cmd->req); 897 dev_kfree_skb(cmd->req);
894 dev_kfree_skb(cmd->resp); 898 dev_kfree_skb(cmd->resp);
895 kfree(cmd); 899 kfree(cmd);
900 return;
896 } 901 }
902
903 dev->cmd = cmd;
897} 904}
898 905
899struct pn533_sync_cmd_response { 906struct pn533_sync_cmd_response {