All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items
@ 2016-10-09 13:32 Wei Yongjun
  2016-10-09 13:44 ` Mintz, Yuval
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Wei Yongjun @ 2016-10-09 13:32 UTC (permalink / raw)
  To: Yuval Mintz, Ariel Elior; +Cc: Wei Yongjun, everest-linux-l2, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>

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 <weiyongjun1@huawei.com>
---
 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);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items
  2016-10-09 13:32 [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items Wei Yongjun
@ 2016-10-09 13:44 ` Mintz, Yuval
  2016-10-10 14:08 ` [PATCH v2] " Wei Yongjun
  2016-10-13 13:47 ` [PATCH] " David Miller
  2 siblings, 0 replies; 7+ messages in thread
From: Mintz, Yuval @ 2016-10-09 13:44 UTC (permalink / raw)
  To: Wei Yongjun, Ariel Elior; +Cc: Wei Yongjun, everest-linux-l2, netdev

> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> 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 <weiyongjun1@huawei.com>
> ---
>  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 <Yuval.Mintz@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] qed: Fix to use list_for_each_entry_safe() when delete items
  2016-10-09 13:32 [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items Wei Yongjun
  2016-10-09 13:44 ` Mintz, Yuval
@ 2016-10-10 14:08 ` Wei Yongjun
  2016-10-13 13:58   ` David Miller
  2016-10-13 13:47 ` [PATCH] " David Miller
  2 siblings, 1 reply; 7+ messages in thread
From: Wei Yongjun @ 2016-10-10 14:08 UTC (permalink / raw)
  To: Yuval Mintz, Ariel Elior; +Cc: Wei Yongjun, everest-linux-l2, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>

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 <weiyongjun1@huawei.com>
Acked-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
---
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);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items
  2016-10-09 13:32 [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items Wei Yongjun
  2016-10-09 13:44 ` Mintz, Yuval
  2016-10-10 14:08 ` [PATCH v2] " Wei Yongjun
@ 2016-10-13 13:47 ` David Miller
  2016-10-13 14:14   ` Mintz, Yuval
  2 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2016-10-13 13:47 UTC (permalink / raw)
  To: weiyj.lk; +Cc: Yuval.Mintz, Ariel.Elior, weiyongjun1, everest-linux-l2, netdev

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Sun,  9 Oct 2016 13:32:22 +0000

> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> 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 <weiyongjun1@huawei.com>

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. :-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] qed: Fix to use list_for_each_entry_safe() when delete items
  2016-10-10 14:08 ` [PATCH v2] " Wei Yongjun
@ 2016-10-13 13:58   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-10-13 13:58 UTC (permalink / raw)
  To: weiyj.lk; +Cc: Yuval.Mintz, Ariel.Elior, weiyongjun1, everest-linux-l2, netdev

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Mon, 10 Oct 2016 14:08:28 +0000

> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> 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 <weiyongjun1@huawei.com>
> Acked-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
> ---
> v1 -> v2: use tmp_buffer instead of tmp

Applied, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items
  2016-10-13 13:47 ` [PATCH] " David Miller
@ 2016-10-13 14:14   ` Mintz, Yuval
  2016-10-13 14:40     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Mintz, Yuval @ 2016-10-13 14:14 UTC (permalink / raw)
  To: David Miller, weiyj.lk; +Cc: Ariel.Elior, weiyongjun1, netdev

> > 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 <weiyongjun1@huawei.com>
> 
> 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].

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items
  2016-10-13 14:14   ` Mintz, Yuval
@ 2016-10-13 14:40     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-10-13 14:40 UTC (permalink / raw)
  To: Yuval.Mintz; +Cc: weiyj.lk, Ariel.Elior, weiyongjun1, netdev

From: "Mintz, Yuval" <Yuval.Mintz@cavium.com>
Date: Thu, 13 Oct 2016 14:14:40 +0000

>> > 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 <weiyongjun1@huawei.com>
>> 
>> 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!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-10-13 15:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-09 13:32 [PATCH] qed: Fix to use list_for_each_entry_safe() when delete items Wei Yongjun
2016-10-09 13:44 ` Mintz, Yuval
2016-10-10 14:08 ` [PATCH v2] " Wei Yongjun
2016-10-13 13:58   ` David Miller
2016-10-13 13:47 ` [PATCH] " David Miller
2016-10-13 14:14   ` Mintz, Yuval
2016-10-13 14:40     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.