From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751813AbdFTI0n (ORCPT ); Tue, 20 Jun 2017 04:26:43 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48188 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbdFTI0l (ORCPT ); Tue, 20 Jun 2017 04:26:41 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BC0BA60AEE Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org Subject: Re: [PATCH] phy: brcm-sata: fix a timeout test in init To: Dan Carpenter , Kishon Vijay Abraham I References: <20170619105251.GA23911@elgon.mountain> Cc: Yendapally Reddy Dhananjaya Reddy , Heiko Stuebner , Florian Fainelli , Axel Lin , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org From: Vivek Gautam Message-ID: <69b479f4-8939-4c11-2c16-2e188e02a625@codeaurora.org> Date: Tue, 20 Jun 2017 13:56:35 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20170619105251.GA23911@elgon.mountain> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/19/2017 04:26 PM, Dan Carpenter wrote: > We want to timeout with try set to zero so this should be a pre-op > instead of post-op. > > Signed-off-by: Dan Carpenter > > 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) { Do we want to try reading the status 50 times? If yes, won't your change break that? It will rather run the loop 49 times. Thanks Vivek > val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK, > BLOCK0_XGXSSTATUS); > if (val & BLOCK0_XGXSSTATUS_PLL_LOCK) -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project