All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Coiby Xu <coiby.xu@gmail.com>
Cc: devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER" 
	<GR-Linux-NIC-Dev@marvell.com>,
	open list <linux-kernel@vger.kernel.org>,
	Manish Chopra <manishc@marvell.com>,
	"open list:QLOGIC QLGE 10Gb ETHERNET DRIVER"
	<netdev@vger.kernel.org>
Subject: Re: [PATCH 2/2] staging: qlge: fix else after return or break
Date: Fri, 26 Jun 2020 11:34:36 +0300	[thread overview]
Message-ID: <20200626083436.GG2549@kadam> (raw)
In-Reply-To: <20200625215755.70329-3-coiby.xu@gmail.com>

On Fri, Jun 26, 2020 at 05:57:55AM +0800, Coiby Xu wrote:
> @@ -1404,11 +1403,10 @@ static void ql_dump_cam_entries(struct ql_adapter *qdev)
>  			pr_err("%s: Failed read of mac index register\n",
>  			       __func__);
>  			return;
                        ^^^^^^
> -		} else {
> -			if (value[0])
> -				pr_err("%s: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x\n",
> -				       qdev->ndev->name, i, value[1], value[0]);
>  		}
> +		if (value[0])
> +			pr_err("%s: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x\n",
> +			       qdev->ndev->name, i, value[1], value[0]);
>  	}
>  	ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  }
> @@ -1427,11 +1425,10 @@ void ql_dump_routing_entries(struct ql_adapter *qdev)
>  			pr_err("%s: Failed read of routing index register\n",
>  			       __func__);
>  			return;
                        ^^^^^^


> -		} else {
> -			if (value)
> -				pr_err("%s: Routing Mask %d = 0x%.08x\n",
> -				       qdev->ndev->name, i, value);
>  		}
> +		if (value)
> +			pr_err("%s: Routing Mask %d = 0x%.08x\n",
> +			       qdev->ndev->name, i, value);
>  	}
>  	ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  }

This is not caused by your patch, but in these two functions we return
without dropping the lock.  There may be other places as well, but these
are the two I can see without leaving my email client.

Do you think you could fix that before we forget?  Just change the
return to a break to fix the bug.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Coiby Xu <coiby.xu@gmail.com>
Cc: devel@driverdev.osuosl.org,
	"supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER"
	<GR-Linux-NIC-Dev@marvell.com>,
	Manish Chopra <manishc@marvell.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:QLOGIC QLGE 10Gb ETHERNET DRIVER"
	<netdev@vger.kernel.org>
Subject: Re: [PATCH 2/2] staging: qlge: fix else after return or break
Date: Fri, 26 Jun 2020 11:34:36 +0300	[thread overview]
Message-ID: <20200626083436.GG2549@kadam> (raw)
In-Reply-To: <20200625215755.70329-3-coiby.xu@gmail.com>

On Fri, Jun 26, 2020 at 05:57:55AM +0800, Coiby Xu wrote:
> @@ -1404,11 +1403,10 @@ static void ql_dump_cam_entries(struct ql_adapter *qdev)
>  			pr_err("%s: Failed read of mac index register\n",
>  			       __func__);
>  			return;
                        ^^^^^^
> -		} else {
> -			if (value[0])
> -				pr_err("%s: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x\n",
> -				       qdev->ndev->name, i, value[1], value[0]);
>  		}
> +		if (value[0])
> +			pr_err("%s: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x\n",
> +			       qdev->ndev->name, i, value[1], value[0]);
>  	}
>  	ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  }
> @@ -1427,11 +1425,10 @@ void ql_dump_routing_entries(struct ql_adapter *qdev)
>  			pr_err("%s: Failed read of routing index register\n",
>  			       __func__);
>  			return;
                        ^^^^^^


> -		} else {
> -			if (value)
> -				pr_err("%s: Routing Mask %d = 0x%.08x\n",
> -				       qdev->ndev->name, i, value);
>  		}
> +		if (value)
> +			pr_err("%s: Routing Mask %d = 0x%.08x\n",
> +			       qdev->ndev->name, i, value);
>  	}
>  	ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  }

This is not caused by your patch, but in these two functions we return
without dropping the lock.  There may be other places as well, but these
are the two I can see without leaving my email client.

Do you think you could fix that before we forget?  Just change the
return to a break to fix the bug.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2020-06-26  8:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 21:57 [PATCH 0/2] staging: qlge: coding style fix for the qlge driver Coiby Xu
2020-06-25 21:57 ` [PATCH 1/2] staging: qlge: fix trailing */ in block comment Coiby Xu
2020-06-25 21:57   ` Coiby Xu
2020-06-25 21:57 ` [PATCH 2/2] staging: qlge: fix else after return or break Coiby Xu
2020-06-25 21:57   ` Coiby Xu
2020-06-25 22:13   ` Joe Perches
2020-06-25 22:13     ` Joe Perches
2020-06-26 11:47     ` Coiby Xu
2020-06-26 11:47       ` Coiby Xu
2020-06-26 23:57     ` Coiby Xu
2020-06-26 23:57       ` Coiby Xu
2020-06-27  0:06       ` Joe Perches
2020-06-27  0:06         ` Joe Perches
2020-06-27 10:21         ` Coiby Xu
2020-06-27 10:21           ` Coiby Xu
2020-06-26  8:34   ` Dan Carpenter [this message]
2020-06-26  8:34     ` Dan Carpenter
2020-06-26 11:41     ` Coiby Xu
2020-06-26 11:41       ` Coiby Xu

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=20200626083436.GG2549@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=coiby.xu@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    /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 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.