From patchwork Sat May 20 17:52:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9738715 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 CEC2B601C2 for ; Sat, 20 May 2017 17:53:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE05B2857D for ; Sat, 20 May 2017 17:53:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0C0528599; Sat, 20 May 2017 17:53:41 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 7837D2857D for ; Sat, 20 May 2017 17:53:40 +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=Y+5j3eE0v5RRLiHNRbdXxDjM635MxPsMU+EWpJH66DM=; b=N2j OEmsUA9bnvMHFdG48iZkaqaXTjbBANd4WB6fYNePDoazyNMvAILmZfaJPnfJo3MBxyw68CQ3SB/5g TxeyrzvPymgBz2beFB/Y48gfWKY9lEcUb1ochECkr4fXzTvlsxDXeQmOV485+MaBd00FBHkVKGNtl kO6Ppm8m2JvJvf+jQ1lBDPV6XnIFozmyjEQGHPJpposj52Wt3neMKLRDoiyrEUprRP2Hix9Towmt+ rLlcZakdW7+Ed7i/qPpcsjAoA5cfMyJS09UkaCvfmM/F1PVu5KvxatNNcMaAW1GDlK929S46KKdVv A7REprXy+min0fTT9LmeMAqsDRRWe2w==; 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 1dC8ZP-0001OL-JB; Sat, 20 May 2017 17:53:39 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dC8ZL-0001Ns-OD for linux-arm-kernel@lists.infradead.org; Sat, 20 May 2017 17:53:37 +0000 Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-07.nifty.com with ESMTP id v4KHqFdD028553; Sun, 21 May 2017 02:52:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v4KHqFdD028553 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1495302757; bh=uN33A6MfeiCkQqW1DrCTFxy5Gz79FRVNLR9f5fPR2U4=; h=From:To:Cc:Subject:Date:From; b=lcMD8WggdcXRqeAi1rNXnizM+HQu9XYS3nJ84m20m+PnLZjcxgJ7QXdHaNPZ6zEx8 vxNgQAEJxKLxRLTtzFhOSV4dA10ptNxPg3NUrOdQ6AT4RPMcJkUsRz3zsw4jkMl97S Zlk5SluWSTMCIh1oH1dqvTLbs6uVG8yRb4wvu0MKttx+DtE2h54x7IdE9VQevh0Jhx nzlDZgzcqDc3U1P5KqK8UQbYJJ/da2XKFMvmcxmQnmrt1JJ6aPq8Eelm2tE9gvOezb bHtrCoKJAYhSqC3x++BwHcj/obdrEo+5E1nSSV+D5XuISdX0et0VBLlyEI8MftA9fi zSoR6PEgDpbSw== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-usb@vger.kernel.org Subject: [PATCH] usb: remove NULL pointer check for clk_disable_unprepare Date: Sun, 21 May 2017 02:52:13 +0900 Message-Id: <1495302733-6669-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170520_105336_027013_2621B8CF X-CRM114-Status: UNSURE ( 9.11 ) 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: Felipe Balbi , kernel@stlinux.com, John Youn , Greg Kroah-Hartman , Patrice Chotard , linux-kernel@vger.kernel.org, Tony Prisk , Masahiro Yamada , Alan Stern , Li Yang , linuxppc-dev@lists.ozlabs.org, 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 After long term efforts of fixing non-common clock implementations, clk_disable() is a no-op for a NULL pointer input, and this is now tree-wide consistent. All clock consumers can safely call clk_disable(_unprepare) without NULL pointer check. Signed-off-by: Masahiro Yamada --- drivers/usb/dwc2/platform.c | 3 +-- drivers/usb/gadget/udc/fsl_mxc_udc.c | 3 +-- drivers/usb/host/ehci-mxc.c | 8 ++------ drivers/usb/host/ehci-platform.c | 3 +-- drivers/usb/host/ehci-spear.c | 3 +-- drivers/usb/host/ehci-st.c | 3 +-- drivers/usb/host/fsl-mph-dr-of.c | 3 +-- drivers/usb/host/ohci-platform.c | 3 +-- drivers/usb/host/ohci-spear.c | 3 +-- drivers/usb/host/ohci-st.c | 3 +-- drivers/usb/misc/usb3503.c | 9 +++------ 11 files changed, 14 insertions(+), 30 deletions(-) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index daf0d37..8c5bf81 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -182,8 +182,7 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) if (ret) return ret; - if (hsotg->clk) - clk_disable_unprepare(hsotg->clk); + clk_disable_unprepare(hsotg->clk); ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); diff --git a/drivers/usb/gadget/udc/fsl_mxc_udc.c b/drivers/usb/gadget/udc/fsl_mxc_udc.c index f16e149..59dbcf7 100644 --- a/drivers/usb/gadget/udc/fsl_mxc_udc.c +++ b/drivers/usb/gadget/udc/fsl_mxc_udc.c @@ -118,8 +118,7 @@ int fsl_udc_clk_finalize(struct platform_device *pdev) void fsl_udc_clk_release(void) { - if (mxc_per_clk) - clk_disable_unprepare(mxc_per_clk); + clk_disable_unprepare(mxc_per_clk); clk_disable_unprepare(mxc_ahb_clk); clk_disable_unprepare(mxc_ipg_clk); } diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index c7a9b31..1db5ef9 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c @@ -155,9 +155,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) if (pdata && pdata->exit) pdata->exit(pdev); err_init: - if (priv->phyclk) - clk_disable_unprepare(priv->phyclk); - + clk_disable_unprepare(priv->phyclk); clk_disable_unprepare(priv->ahbclk); err_clk_ahb: clk_disable_unprepare(priv->usbclk); @@ -183,9 +181,7 @@ static int ehci_mxc_drv_remove(struct platform_device *pdev) clk_disable_unprepare(priv->usbclk); clk_disable_unprepare(priv->ahbclk); - - if (priv->phyclk) - clk_disable_unprepare(priv->phyclk); + clk_disable_unprepare(priv->phyclk); usb_put_hcd(hcd); return 0; diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index bc7b9be..2d41447 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -127,8 +127,7 @@ static void ehci_platform_power_off(struct platform_device *dev) } for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } static struct hc_driver __read_mostly ehci_platform_hc_driver; diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 1f25c79..57257aa 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -138,8 +138,7 @@ static int spear_ehci_hcd_drv_remove(struct platform_device *pdev) usb_remove_hcd(hcd); - if (sehci->clk) - clk_disable_unprepare(sehci->clk); + clk_disable_unprepare(sehci->clk); usb_put_hcd(hcd); return 0; diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c index be4a278..f3c433d 100644 --- a/drivers/usb/host/ehci-st.c +++ b/drivers/usb/host/ehci-st.c @@ -130,8 +130,7 @@ static void st_ehci_platform_power_off(struct platform_device *dev) phy_exit(priv->phy); for (clk = USB_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index e90ddb5..ec5562d 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -325,8 +325,7 @@ static void fsl_usb2_mpc5121_exit(struct platform_device *pdev) pdata->regs = NULL; - if (pdata->clk) - clk_disable_unprepare(pdata->clk); + clk_disable_unprepare(pdata->clk); } static struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 6368fce..200137a 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -94,8 +94,7 @@ static void ohci_platform_power_off(struct platform_device *dev) } for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } static struct hc_driver __read_mostly ohci_platform_hc_driver; diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 56478ed..4037130 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -111,8 +111,7 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) struct spear_ohci *sohci_p = to_spear_ohci(hcd); usb_remove_hcd(hcd); - if (sohci_p->clk) - clk_disable_unprepare(sohci_p->clk); + clk_disable_unprepare(sohci_p->clk); usb_put_hcd(hcd); return 0; diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c index 02816a1..05ede9d 100644 --- a/drivers/usb/host/ohci-st.c +++ b/drivers/usb/host/ohci-st.c @@ -112,8 +112,7 @@ static void st_ohci_platform_power_off(struct platform_device *dev) phy_exit(priv->phy); for (clk = USB_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } static struct hc_driver __read_mostly ohci_platform_hc_driver; diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index 8e7737d..1d4d1e4 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c @@ -335,8 +335,7 @@ static int usb3503_i2c_remove(struct i2c_client *i2c) struct usb3503 *hub; hub = i2c_get_clientdata(i2c); - if (hub->clk) - clk_disable_unprepare(hub->clk); + clk_disable_unprepare(hub->clk); return 0; } @@ -359,8 +358,7 @@ static int usb3503_platform_remove(struct platform_device *pdev) struct usb3503 *hub; hub = platform_get_drvdata(pdev); - if (hub->clk) - clk_disable_unprepare(hub->clk); + clk_disable_unprepare(hub->clk); return 0; } @@ -373,8 +371,7 @@ static int usb3503_i2c_suspend(struct device *dev) usb3503_switch_mode(hub, USB3503_MODE_STANDBY); - if (hub->clk) - clk_disable_unprepare(hub->clk); + clk_disable_unprepare(hub->clk); return 0; }