Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751914AbcKRDRa (ORCPT ); Thu, 17 Nov 2016 22:17:30 -0500 Received: from regular1.263xmail.com ([211.150.99.137]:60326 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbcKRDR3 (ORCPT ); Thu, 17 Nov 2016 22:17:29 -0500 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: wulf@rock-chips.com X-FST-TO: linux-rockchip@lists.infradead.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: wulf@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [PATCH 1/2] phy: rockchip-inno-usb2: fix uninitialized tmout variable To: Arnd Bergmann , Kishon Vijay Abraham I References: <20161116142259.2123506-1-arnd@arndb.de> Cc: Heiko Stuebner , Douglas Anderson , Frank Wang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org From: wlf Message-ID: <4f75b364-c79a-2d03-00e1-42e941b75b2e@rock-chips.com> Date: Fri, 18 Nov 2016 11:17:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161116142259.2123506-1-arnd@arndb.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1484 Lines: 41 Hi Arnd, 在 2016年11月16日 22:22, Arnd Bergmann 写道: > The newly added OTG support has an obvious uninitialized variable > access that gcc warns about: > > drivers/phy/phy-rockchip-inno-usb2.c: In function 'rockchip_chg_detect_work': > drivers/phy/phy-rockchip-inno-usb2.c:717:7: error: 'tmout' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > This replaces the use of the uninitialized variable with what > the value was in the previous USB_CHG_STATE_WAIT_FOR_DCD > state. > > Fixes: 0c42fe48fd23 ("phy: rockchip-inno-usb2: support otg-port for rk3399") > Signed-off-by: Arnd Bergmann > --- > drivers/phy/phy-rockchip-inno-usb2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c > index eb89de59b68f..2f99ec95079c 100644 > --- a/drivers/phy/phy-rockchip-inno-usb2.c > +++ b/drivers/phy/phy-rockchip-inno-usb2.c > @@ -714,7 +714,7 @@ static void rockchip_chg_detect_work(struct work_struct *work) > delay = CHG_SECONDARY_DET_TIME; > rphy->chg_state = USB_CHG_STATE_PRIMARY_DONE; > } else { > - if (tmout) { > + if (rphy->dcd_retries == CHG_DCD_MAX_RETRIES) { > /* floating charger found */ > rphy->chg_type = POWER_SUPPLY_TYPE_USB_DCP; > rphy->chg_state = USB_CHG_STATE_DETECTED; Thanks very much for your help. Reviewed-by: William Wu Best Regards, wulf