Skip to contentSkip to conversation

Bluetooth: Use list_del when freeing the list entry

PATCH In review [email protected] 2 participants 2 messages Jul 4, 2014

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

PATCH 1/1 Bluetooth: Use list_del when freeing the list entry

From: Johan Hedberg <[email protected]>

It's wasteful to use list_del_init (which re-initializes the list_head) if we're just about to free the element and never use it again.

---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/mgmt.c +1 -1
index f1672b15c0f3..90eabcae3ed2 100644
@@ -5225,7 +5225,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
 			goto unlock;
 		}
 
-		list_del_init(&params->action);
+		list_del(&params->action);
 		list_del(&params->list);
 		kfree(params);
 		hci_update_background_scan(hdev);
Signature · 1 line
1.9.3
maintainer
#1 lore raw

Hi Johan,

Quoted 7 lines

It's wasteful to use list_del_init (which re-initializes the list_head) if we're just about to free the element and never use it again.

---
net/bluetooth/mgmt.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel