Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753881AbcKPOXn (ORCPT ); Wed, 16 Nov 2016 09:23:43 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:60589 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752131AbcKPOXm (ORCPT ); Wed, 16 Nov 2016 09:23:42 -0500 From: Arnd Bergmann To: Kishon Vijay Abraham I Cc: Arnd Bergmann , Heiko Stuebner , William Wu , Douglas Anderson , Frank Wang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 1/2] phy: rockchip-inno-usb2: fix uninitialized tmout variable Date: Wed, 16 Nov 2016 15:22:38 +0100 Message-Id: <20161116142259.2123506-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:bgIS139WyZ7Goqs8kOlJ0bKzDA4eBXRvgB4rYsQwZFAUBiWnzNo 7knHhET2GNvuhnC/DUetGc9M/SjLUrSzPxf2c85GwlK+RSNmxdVrcKYI2MtvZKpebdf6Tlq GxsIXWsyzGD62ThqbHCmWWjsOovi4TpyLv2BLnTASyw/LBxTrXkALLCbACMyZF9A0QPL2gD ZoccrO1h/Ox5QO2Cw4l2Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:FcjFL18RT+4=:x6e5qYgWKmYtjxVD8jyLqw lmypGagl/W6zWqzZmmLxDrSdOakIwI0J/6ewcmZmPOQK1Oy5ijn3bizUYICaNL3V80l9ar0P8 plRwrK5il20O/YwC4YMZAej8ssKfJv7suCV643vnj1PmxgXbf2jogbQksHz1VI0FTu/Gh0BUc LNLJSlUwNX+Nq9QNnsW4UslQ5L1mMe8udtfBgdBpiUHDd6iLXrDdxCC7jPKDX0qV5Tmws5mPM XDWM2WmGdMF1rjAbgALQfn1yuto1vQ5yFJ4+f7WP9Wj2jD/rgplJcSgzsC0cb6v7lbK/WWXUq iA0BHTkYZ+Fb/hxRBe4jeSULGOYRCKwvzanupef5sCZc3JP2Q6qKZ1oJz7SZc0SvI9IUepmEW prm3WSJBdM7TIIDm9rWwABrbWckWEt8nAK6t/PONFM1uQgxm93uo1JSoxGo5ZQ8MO8m6nnms1 xpdk3030lU2gRcr93WiiAOmy+b31RuduMVZpGI3QXlLNRR1I+DI8EOcuPIXKDCU6moBoGxi+Z QUKIOPOgmq67kl678qmZm/uwbhyHjD9jPp+7L/5bTLkSLl5mU/Hmnr9gVdHdPw+698a8sRYaM Xa/nt1HBfW+sj3OGSW21rZNBGA9K4FPZdvA2CwVA9yeVJKN4k3VSRyRJq3wUFgggjyyosVN1Z pDde0Tq0wFFAifgR5XOROAwUwSKXGPc+S/oSFExSNFctQ0HDCLczBxRdpX3K2HmXqPBw= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1258 Lines: 31 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; -- 2.9.0