From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752050AbcFUIoj (ORCPT ); Tue, 21 Jun 2016 04:44:39 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:49310 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbcFUIih (ORCPT ); Tue, 21 Jun 2016 04:38:37 -0400 Date: Tue, 21 Jun 2016 11:37:40 +0300 From: Dan Carpenter To: Kishon Vijay Abraham I , Yendapally Reddy Dhananjaya Reddy Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] phy: phy-brcm-sata: fix a loop timeout Message-ID: <20160621083740.GA16083@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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)