diff options
author | Mathias Jeppsson <mathias.jeppsson@sonymobile.com> | 2012-07-06 18:53:18 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-07-10 11:42:50 -0400 |
commit | 1913e57cf9a7be4565c56a3fbfd85106919ea006 (patch) | |
tree | b2c0e0c33b42a229b7cba1555a4331f1d511ff42 /net/nfc | |
parent | b48d96652626b315229b1b82c6270eead6a77a6d (diff) |
NFC: Fix empty HCI message list check
list_first_entry() will never return NULL. Instead use
list_for_each_entry_safe() to iterate through the list.
Signed-off-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/hci/core.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index e1a640d2b588..da6e039c8606 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -682,13 +682,12 @@ EXPORT_SYMBOL(nfc_hci_register_device); | |||
682 | 682 | ||
683 | void nfc_hci_unregister_device(struct nfc_hci_dev *hdev) | 683 | void nfc_hci_unregister_device(struct nfc_hci_dev *hdev) |
684 | { | 684 | { |
685 | struct hci_msg *msg; | 685 | struct hci_msg *msg, *n; |
686 | 686 | ||
687 | skb_queue_purge(&hdev->rx_hcp_frags); | 687 | skb_queue_purge(&hdev->rx_hcp_frags); |
688 | skb_queue_purge(&hdev->msg_rx_queue); | 688 | skb_queue_purge(&hdev->msg_rx_queue); |
689 | 689 | ||
690 | while ((msg = list_first_entry(&hdev->msg_tx_queue, struct hci_msg, | 690 | list_for_each_entry_safe(msg, n, &hdev->msg_tx_queue, msg_l) { |
691 | msg_l)) != NULL) { | ||
692 | list_del(&msg->msg_l); | 691 | list_del(&msg->msg_l); |
693 | skb_queue_purge(&msg->msg_frags); | 692 | skb_queue_purge(&msg->msg_frags); |
694 | kfree(msg); | 693 | kfree(msg); |