From patchwork Fri Nov 10 21:55:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 10053825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C15976032D for ; Fri, 10 Nov 2017 21:56:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B47772929B for ; Fri, 10 Nov 2017 21:56:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8D702B11C; Fri, 10 Nov 2017 21:56:16 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 4A2522929B for ; Fri, 10 Nov 2017 21:56:16 +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=bowu01Bmeq8P6bd8FxJ7b/pWJX8fgaGFlZMEEUGBiBk=; b=ru+ ntMaNC5GcN+QD+mIoHzS+c9X9NdHGaxBISCmls0HV/mR6YQVbfHL0pLXbfYd4Zr2M/TONbVIUuV1G 5eeS4/Dv0Ik+XBHvEV5hyy3qiLgEy9u1ZnjeBTrt7/BQJJvY/3l51zZ0YTEkGn76qaX0A98JZp0Sx su8kLAGx5/lF3AxZ/Tvh7i2PJHjNwiNIlQ9JbWDej6jt7IVxyEnK2/hCdoi9vgXkRL4ZF9sNPApHH TDHFUMCp4LTPr+oSGVR7VAPJZPLruYrxXelcSuxUoxwnAlC8x8Dk5p1jkyivUjnOccQU0p0yHh2XE org4q+/FSeukre+n4U5bYTxenwtbUFA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eDHHb-0001Pw-No; Fri, 10 Nov 2017 21:56:15 +0000 Received: from mail.ispras.ru ([83.149.199.45]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eDHHX-0001Ip-8Y; Fri, 10 Nov 2017 21:56:13 +0000 Received: from localhost.localdomain (ppp85-140-185-44.pppoe.mtu-net.ru [85.140.185.44]) by mail.ispras.ru (Postfix) with ESMTPSA id 5418254006C; Sat, 11 Nov 2017 00:55:39 +0300 (MSK) From: Alexey Khoroshilov To: Frank Wang , Kishon Vijay Abraham I Subject: [PATCH] phy: rockchip-inno-usb2: fix error handling in rockchip_usb2phy_probe() Date: Sat, 11 Nov 2017 00:55:32 +0300 Message-Id: <1510350932-3461-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-20171110_135611_551187_BAAC8F2F X-CRM114-Status: UNSURE ( 7.94 ) 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, Heiko Stuebner , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Alexey Khoroshilov , 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 rockchip_usb2phy_probe() does not disable clock in case of failure in devm_of_phy_provider_register() and it ignores if clk_prepare_enable() fails. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index ee7ce5ee53f9..ada1ff33cad3 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1150,7 +1150,12 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) rphy->clk = of_clk_get_by_name(np, "phyclk"); if (!IS_ERR(rphy->clk)) { - clk_prepare_enable(rphy->clk); + ret = clk_prepare_enable(rphy->clk); + if (ret) { + dev_info(&pdev->dev, "failed to prepare phyclk\n"); + clk_put(rphy->clk); + rphy->clk = NULL; + } } else { dev_info(&pdev->dev, "no phyclk specified\n"); rphy->clk = NULL; @@ -1202,7 +1207,11 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) } provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); - return PTR_ERR_OR_ZERO(provider); + if (IS_ERR(provider)) { + ret = PTR_ERR(provider); + goto disable_clks; + } + return 0; put_child: of_node_put(child_np);