From patchwork Sat Jan 26 19:48:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 10782569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E18E313B5 for ; Sat, 26 Jan 2019 19:49:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C10932D03D for ; Sat, 26 Jan 2019 19:49:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF18B2D048; Sat, 26 Jan 2019 19:49:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A47472D03D for ; Sat, 26 Jan 2019 19:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=W7MBwIYxhK4nRBPJ1fTVBunLFzInQfz1MEYsgKXFKME=; b=ia8 K0Yv9SODCAF84f+KPZ90b5PFEsGFcwYEg7Me5d6tly7xbrqpuGx+vRXLKlCgrbEX5AIiB0oCSW8OT YCb2b5N4ZyJ6e/goiY1Z5qgSspj7j0C8rB+gPqeaA9HFkoz6ukDnSWzwdyN0KH2RvLgEs78AIBSDQ O9TwXzZRAwoCHPwaHxEHJX/6kkYpS3LFP+E4tcnd9b3x6kNjEyZaWxmJyG89Uk4QfWvVxAIWFy0oM 1XtY6IJLYkepMr+zgyM8J49YfSXCeQUbf6crbLG5nnU9Wu8UNuadpoTEwwiZFErgUo7Vis5APTDtE JwAKvc6fjNtpDcXiw6fhWWe30XNiE3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gnTxG-000325-6o; Sat, 26 Jan 2019 19:49:26 +0000 Received: from mail.ispras.ru ([83.149.199.45]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gnTx9-00031j-Px for linux-arm-kernel@lists.infradead.org; Sat, 26 Jan 2019 19:49:22 +0000 Received: from localhost.localdomain (109-252-62-199.nat.spd-mgts.ru [109.252.62.199]) by mail.ispras.ru (Postfix) with ESMTPSA id 50449540082; Sat, 26 Jan 2019 22:49:12 +0300 (MSK) From: Alexey Khoroshilov To: David Wu Subject: [PATCH] net: stmmac: dwmac-rk: fix error handling in rk_gmac_powerup() Date: Sat, 26 Jan 2019 22:48:57 +0300 Message-Id: <1548532137-15618-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190126_114920_075606_235908B8 X-CRM114-Status: UNSURE ( 8.19 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ldv-project@linuxtesting.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Abreu , Alexey Khoroshilov , Giuseppe Cavallaro , "David S. Miller" , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If phy_power_on() fails in rk_gmac_powerup(), clocks are left enabled. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 7b923362ee55..3b174eae77c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -1342,8 +1342,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) } ret = phy_power_on(bsp_priv, true); - if (ret) + if (ret) { + gmac_clk_enable(bsp_priv, false); return ret; + } pm_runtime_enable(dev); pm_runtime_get_sync(dev);