[PATCH] qed: Fix to use list_for_each_entry_safe() when delete items

Subsystems: networking drivers, qlogic ql4xxx ethernet driver, the rest

STALE3604d

7 messages, 3 authors, 2016-10-13 · open the first message on its own page

[PATCH] qed: Fix to use list_for_each_entry_safe() when delete items

From: Wei Yongjun <hidden>
Date: 2016-10-09 14:42:32

From: Wei Yongjun <redacted>

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Fixes: 0a7fb11c23c0 ("qed: Add Light L2 support")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index a6db107..4428333 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -1517,7 +1517,7 @@ static void qed_ll2_register_cb_ops(struct qed_dev *cdev,
 static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
 {
 	struct qed_ll2_info ll2_info;
-	struct qed_ll2_buffer *buffer;
+	struct qed_ll2_buffer *buffer, *tmp;
 	enum qed_ll2_conn_type conn_type;
 	struct qed_ptt *p_ptt;
 	int rc, i;
@@ -1587,7 +1587,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
 
 	/* Post all Rx buffers to FW */
 	spin_lock_bh(&cdev->ll2->lock);
-	list_for_each_entry(buffer, &cdev->ll2->list, list) {
+	list_for_each_entry_safe(buffer, tmp, &cdev->ll2->list, list) {
 		rc = qed_ll2_post_rx_buffer(QED_LEADING_HWFN(cdev),
 					    cdev->ll2->handle,
 					    buffer->phys_addr, 0, buffer, 1);

RE: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items

From: Mintz, Yuval <hidden>
Date: 2016-10-09 14:20:08

quoted hunk
From: Wei Yongjun <redacted>

Since we will remove items off the list using list_del() we need to use a safe
version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Fixes: 0a7fb11c23c0 ("qed: Add Light L2 support")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index a6db107..4428333 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -1517,7 +1517,7 @@ static void qed_ll2_register_cb_ops(struct qed_dev
*cdev,  static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params
*params)  {
 	struct qed_ll2_info ll2_info;
-	struct qed_ll2_buffer *buffer;
+	struct qed_ll2_buffer *buffer, *tmp;
 	enum qed_ll2_conn_type conn_type;
 	struct qed_ptt *p_ptt;
 	int rc, i;
@@ -1587,7 +1587,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct
qed_ll2_params *params)

 	/* Post all Rx buffers to FW */
 	spin_lock_bh(&cdev->ll2->lock);
-	list_for_each_entry(buffer, &cdev->ll2->list, list) {
+	list_for_each_entry_safe(buffer, tmp, &cdev->ll2->list, list) {
 		rc = qed_ll2_post_rx_buffer(QED_LEADING_HWFN(cdev),
 					    cdev->ll2->handle,
 					    buffer->phys_addr, 0, buffer, 1);
Thanks for the catch.

A single petty comment - having the variable called 'tmp' in such a long
function is far from informative. Perhaps 'tmp_buffer' would have been
better.

Regardless,
Acked-by: Yuval Mintz <redacted>

[PATCH v2] qed: Fix to use list_for_each_entry_safe() when delete items

From: Wei Yongjun <hidden>
Date: 2016-10-10 14:08:38

From: Wei Yongjun <redacted>

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: Wei Yongjun <redacted>
Acked-by: Yuval Mintz <redacted>
---
v1 -> v2: use tmp_buffer instead of tmp
---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index a6db107..02a8be2 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -1517,7 +1517,7 @@ static void qed_ll2_register_cb_ops(struct qed_dev *cdev,
 static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
 {
 	struct qed_ll2_info ll2_info;
-	struct qed_ll2_buffer *buffer;
+	struct qed_ll2_buffer *buffer, *tmp_buffer;
 	enum qed_ll2_conn_type conn_type;
 	struct qed_ptt *p_ptt;
 	int rc, i;
@@ -1587,7 +1587,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
 
 	/* Post all Rx buffers to FW */
 	spin_lock_bh(&cdev->ll2->lock);
-	list_for_each_entry(buffer, &cdev->ll2->list, list) {
+	list_for_each_entry_safe(buffer, tmp_buffer, &cdev->ll2->list, list) {
 		rc = qed_ll2_post_rx_buffer(QED_LEADING_HWFN(cdev),
 					    cdev->ll2->handle,
 					    buffer->phys_addr, 0, buffer, 1);

Re: [PATCH v2] qed: Fix to use list_for_each_entry_safe() when delete items

From: David Miller <davem@davemloft.net>
Date: 2016-10-13 13:59:25

From: Wei Yongjun <redacted>
Date: Mon, 10 Oct 2016 14:08:28 +0000
From: Wei Yongjun <redacted>

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: Wei Yongjun <redacted>
Acked-by: Yuval Mintz <redacted>
---
v1 -> v2: use tmp_buffer instead of tmp
Applied, thanks.

Re: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items

From: David Miller <davem@davemloft.net>
Date: 2016-10-13 13:59:25

From: Wei Yongjun <redacted>
Date: Sun,  9 Oct 2016 13:32:22 +0000
From: Wei Yongjun <redacted>

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Fixes: 0a7fb11c23c0 ("qed: Add Light L2 support")
Signed-off-by: Wei Yongjun <redacted>
Can the QED maintainers please review this simple fix?

In my opinion 4 days is sufficient time in which to expect a
reasonable review to occur, let me know if you disagree. :-)

Re: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items

From: David Miller <davem@davemloft.net>
Date: 2016-10-13 14:47:52

From: "Mintz, Yuval" <redacted>
Date: Thu, 13 Oct 2016 14:14:40 +0000
quoted
quoted
Since we will remove items off the list using list_del() we need to
use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Fixes: 0a7fb11c23c0 ("qed: Add Light L2 support")
Signed-off-by: Wei Yongjun <redacted>
Can the QED maintainers please review this simple fix?

In my opinion 4 days is sufficient time in which to expect a reasonable review to
occur, let me know if you disagree. :-)
Sorry about that; The high holy days are killing our productivity. :-(
I did ACK v1, though [and v2 was purely semantic change].
Indeed, I just noticed that, thanks!

RE: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items

From: Mintz, Yuval <hidden>
Date: 2016-10-13 15:52:54

quoted
Since we will remove items off the list using list_del() we need to
use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Fixes: 0a7fb11c23c0 ("qed: Add Light L2 support")
Signed-off-by: Wei Yongjun <redacted>
Can the QED maintainers please review this simple fix?

In my opinion 4 days is sufficient time in which to expect a reasonable review to
occur, let me know if you disagree. :-)
Sorry about that; The high holy days are killing our productivity. :-(
I did ACK v1, though [and v2 was purely semantic change].
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help