linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: phy-brcm-sata: Fix a loop timeout
@ 2017-05-18  7:42 Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-05-18  7:42 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Yendapally Reddy Dhananjaya Reddy
  Cc: Vivek Gautam, Krzysztof Kozlowski, Yoshihiro Shimoda,
	Florian Fainelli, Axel Lin, linux-kernel, kernel-janitors

We expect to timeout with "try" set to zero but it's a post-op so
actually it ends with it set to -1.  I've fixed this by changing it to a
pre-op.

Fixes: 024812889ad1 ("phy: Add SATA3 PHY support for Broadcom NSP SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/phy/broadcom/phy-brcm-sata.c b/drivers/phy/broadcom/phy-brcm-sata.c
index ccbc3d994998..48fb016ce689 100644
--- a/drivers/phy/broadcom/phy-brcm-sata.c
+++ b/drivers/phy/broadcom/phy-brcm-sata.c
@@ -329,7 +329,7 @@ static int brcm_nsp_sata_init(struct brcm_sata_port *port)
 
 	/* Wait for pll_seq_done bit */
 	try = 50;
-	while (try--) {
+	while (--try) {
 		val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
 					BLOCK0_XGXSSTATUS);
 		if (val & BLOCK0_XGXSSTATUS_PLL_LOCK)

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

* Re: [patch] phy: phy-brcm-sata: fix a loop timeout
@ 2016-07-18  5:52 Yendapally Reddy Dhananjaya Reddy
  0 siblings, 0 replies; 3+ messages in thread
From: Yendapally Reddy Dhananjaya Reddy @ 2016-07-18  5:52 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Kishon Vijay Abraham I, linux-kernel, kernel-janitors

On Tue, Jun 21, 2016 at 2:07 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Since this loop is a post op then it means we end with "try == -1" but
> afterward we test for if it's zero.  Fix this by changing to a pre-op so
> we end on zero.

Thanks Dan. That should be pre-op.

Thnaks
Dhananjay
>
> Fixes: 024812889ad1 ('phy: Add SATA3 PHY support for Broadcom NSP SoC')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/phy/phy-brcm-sata.c b/drivers/phy/phy-brcm-sata.c
> index 18d6626..c86456f 100644
> --- a/drivers/phy/phy-brcm-sata.c
> +++ b/drivers/phy/phy-brcm-sata.c
> @@ -329,7 +329,7 @@ static int brcm_nsp_sata_init(struct brcm_sata_port *port)
>
>         /* Wait for pll_seq_done bit */
>         try = 50;
> -       while (try--) {
> +       while (--try) {
>                 val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
>                                         BLOCK0_XGXSSTATUS);
>                 if (val & BLOCK0_XGXSSTATUS_PLL_LOCK)

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

* [patch] phy: phy-brcm-sata: fix a loop timeout
@ 2016-06-21  8:37 Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-06-21  8:37 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Yendapally Reddy Dhananjaya Reddy
  Cc: linux-kernel, kernel-janitors

Since this loop is a post op then it means we end with "try == -1" but
afterward we test for if it's zero.  Fix this by changing to a pre-op so
we end on zero.

Fixes: 024812889ad1 ('phy: Add SATA3 PHY support for Broadcom NSP SoC')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/phy/phy-brcm-sata.c b/drivers/phy/phy-brcm-sata.c
index 18d6626..c86456f 100644
--- a/drivers/phy/phy-brcm-sata.c
+++ b/drivers/phy/phy-brcm-sata.c
@@ -329,7 +329,7 @@ static int brcm_nsp_sata_init(struct brcm_sata_port *port)
 
 	/* Wait for pll_seq_done bit */
 	try = 50;
-	while (try--) {
+	while (--try) {
 		val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
 					BLOCK0_XGXSSTATUS);
 		if (val & BLOCK0_XGXSSTATUS_PLL_LOCK)

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

end of thread, other threads:[~2017-05-18  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18  7:42 [PATCH] phy: phy-brcm-sata: Fix a loop timeout Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2016-07-18  5:52 [patch] phy: phy-brcm-sata: fix " Yendapally Reddy Dhananjaya Reddy
2016-06-21  8:37 Dan Carpenter

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