linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
To: weiyj_lk@163.com, John Allen <jallen@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Cc: netdev@vger.kernel.org,
	Wei Yongjun <yongjun_wei@trendmicro.com.cn>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items
Date: Mon, 20 Jun 2016 10:50:26 -0500	[thread overview]
Message-ID: <576810C2.6080208@linux.vnet.ibm.com> (raw)
In-Reply-To: <1466218408-20940-1-git-send-email-weiyj_lk@163.com>

On 06/17/2016 09:53 PM, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Since we will remove items off the list using list_del() we need
> to use a safe version of the list_for_each() macro aptly named
> list_for_each_safe().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/net/ethernet/ibm/ibmvnic.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 864cb21..0b6a922 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -3141,14 +3141,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq,
>  
>  static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter)
>  {
> -	struct ibmvnic_inflight_cmd *inflight_cmd;
> +	struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1;
>  	struct device *dev = &adapter->vdev->dev;
> -	struct ibmvnic_error_buff *error_buff;
> +	struct ibmvnic_error_buff *error_buff, *tmp2;
>  	unsigned long flags;
>  	unsigned long flags2;
>  
>  	spin_lock_irqsave(&adapter->inflight_lock, flags);
> -	list_for_each_entry(inflight_cmd, &adapter->inflight, list) {
> +	list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) {
>  		switch (inflight_cmd->crq.generic.cmd) {
>  		case LOGIN:
>  			dma_unmap_single(dev, adapter->login_buf_token,
> @@ -3165,8 +3165,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter)
>  			break;
>  		case REQUEST_ERROR_INFO:
>  			spin_lock_irqsave(&adapter->error_list_lock, flags2);
> -			list_for_each_entry(error_buff, &adapter->errors,
> -					    list) {
> +			list_for_each_entry_safe(error_buff, tmp2,
> +						 &adapter->errors, list) {
>  				dma_unmap_single(dev, error_buff->dma,
>  						 error_buff->len,
>  						 DMA_FROM_DEVICE);
>
Thanks!

Acked-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
>
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

  reply	other threads:[~2016-06-20 15:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-18  2:53 [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items weiyj_lk
2016-06-20 15:50 ` Thomas Falcon [this message]
2016-06-21 16:01   ` Thomas Falcon
2016-06-22  2:23     ` Wei Yongjun
2016-06-22  2:51     ` [PATCH v2] " Wei Yongjun
2016-06-25 16:02       ` David Miller
2016-06-27 12:48         ` weiyj_lk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576810C2.6080208@linux.vnet.ibm.com \
    --to=tlfalcon@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=jallen@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=weiyj_lk@163.com \
    --cc=yongjun_wei@trendmicro.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).