2012-07-06 22:41:58

by Samuel Ortiz

[permalink] [raw]
Subject: [PATCH 0/2] 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(-)

--
1.7.10



2012-07-06 22:42:03

by Samuel Ortiz

[permalink] [raw]
Subject: [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.

Signed-off-by: Mathias Jeppsson <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
---
net/nfc/hci/core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index e1a640d..da6e039 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -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);
--
1.7.10


2012-07-06 22:42:29

by Samuel Ortiz

[permalink] [raw]
Subject: [PATCH 2/2] NFC: Fix order of arguments to list_add_tail() when queueing HCP frames

From: Mathias Jeppsson <[email protected]>

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

Signed-off-by: Mathias Jeppsson <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
---
net/nfc/hci/hcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/nfc/hci/hcp.c b/net/nfc/hci/hcp.c
index 7212cf2..f4dad1a 100644
--- a/net/nfc/hci/hcp.c
+++ b/net/nfc/hci/hcp.c
@@ -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);
--
1.7.10