From patchwork Fri Nov 18 13:28:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 82892 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp77408qge; Fri, 18 Nov 2016 05:31:35 -0800 (PST) X-Received: by 10.37.246.9 with SMTP id t9mr4521088ybd.107.1479475895849; Fri, 18 Nov 2016 05:31:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si1683062ywe.346.2016.11.18.05.31.35; Fri, 18 Nov 2016 05:31:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbcKRNaL (ORCPT + 26 others); Fri, 18 Nov 2016 08:30:11 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:53695 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753229AbcKRN3P (ORCPT ); Fri, 18 Nov 2016 08:29:15 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id uAIDTFiH018433; Fri, 18 Nov 2016 07:29:15 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id uAIDTFQi029984; Fri, 18 Nov 2016 07:29:15 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Fri, 18 Nov 2016 07:29:14 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id uAIDShN2020893; Fri, 18 Nov 2016 07:29:13 -0600 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 19/20] phy: rockchip-inno-usb2: fix uninitialized tmout variable Date: Fri, 18 Nov 2016 18:58:42 +0530 Message-ID: <1479475723-4857-20-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1479475723-4857-1-git-send-email-kishon@ti.com> References: <1479475723-4857-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: 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 Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-rockchip-inno-usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c index eb89de5..2f99ec9 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;