Skip to contentSkip to conversation

NFC fixes for 3.5

PATCH New Samuel Ortiz 1 participant 3 messages Jul 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover NFC fixes for 3.5

Hi John,

I have a couple of HCI fixes from Mathias, for 3.5. Thanks in advance for pulling them in.

You can pull them from:

git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-3.0.git tags/nfc-fixes-3.5-2

Mathias Jeppsson (2):
NFC: Fix empty HCI message list check
NFC: Fix order of arguments to list_add_tail() when queueing HCP
frames

 net/nfc/hci/core.c |    5 ++---
 net/nfc/hci/hcp.c  |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/2 NFC: Fix empty HCI message list check

From: Mathias Jeppsson <[email protected]>

list_first_entry() will never return NULL. Instead use list_for_each_entry_safe() to iterate through the list.

---
 net/nfc/hci/core.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/nfc/hci/core.c +2 -3
index e1a640d..da6e039 100644
@@ -682,13 +682,12 @@ EXPORT_SYMBOL(nfc_hci_register_device);
 
 void nfc_hci_unregister_device(struct nfc_hci_dev *hdev)
 {
-	struct hci_msg *msg;
+	struct hci_msg *msg, *n;
 
 	skb_queue_purge(&hdev->rx_hcp_frags);
 	skb_queue_purge(&hdev->msg_rx_queue);
 
-	while ((msg = list_first_entry(&hdev->msg_tx_queue, struct hci_msg,
-				       msg_l)) != NULL) {
+	list_for_each_entry_safe(msg, n, &hdev->msg_tx_queue, msg_l) {
 		list_del(&msg->msg_l);
 		skb_queue_purge(&msg->msg_frags);
 		kfree(msg);
Signature · 1 line
1.7.10
#2 lore raw

PATCH 2/2 NFC: Fix order of arguments to list_add_tail() when queueing HCP frames

In reply to Samuel Ortiz

From: Mathias Jeppsson <[email protected]>

The HCP message should be added to transmit queue, not the other way around.

---
 net/nfc/hci/hcp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/nfc/hci/hcp.c +1 -1
index 7212cf2..f4dad1a 100644
@@ -105,7 +105,7 @@ int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe,
 	}
 
 	mutex_lock(&hdev->msg_tx_mutex);
-	list_add_tail(&hdev->msg_tx_queue, &cmd->msg_l);
+	list_add_tail(&cmd->msg_l, &hdev->msg_tx_queue);
 	mutex_unlock(&hdev->msg_tx_mutex);
 
 	queue_work(hdev->msg_tx_wq, &hdev->msg_tx_work);
Signature · 1 line
1.7.10