mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 00:39:48 +00:00
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>
This commit is contained in:
parent
b48d966526
commit
1913e57cf9
1 changed files with 2 additions and 3 deletions
|
@ -682,13 +682,12 @@ EXPORT_SYMBOL(nfc_hci_register_device);
|
||||||
|
|
||||||
void nfc_hci_unregister_device(struct nfc_hci_dev *hdev)
|
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->rx_hcp_frags);
|
||||||
skb_queue_purge(&hdev->msg_rx_queue);
|
skb_queue_purge(&hdev->msg_rx_queue);
|
||||||
|
|
||||||
while ((msg = list_first_entry(&hdev->msg_tx_queue, struct hci_msg,
|
list_for_each_entry_safe(msg, n, &hdev->msg_tx_queue, msg_l) {
|
||||||
msg_l)) != NULL) {
|
|
||||||
list_del(&msg->msg_l);
|
list_del(&msg->msg_l);
|
||||||
skb_queue_purge(&msg->msg_frags);
|
skb_queue_purge(&msg->msg_frags);
|
||||||
kfree(msg);
|
kfree(msg);
|
||||||
|
|
Loading…
Reference in a new issue