From patchwork Thu Jan 12 21:59:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 641936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06F4BC54EBE for ; Thu, 12 Jan 2023 22:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240208AbjALWJx (ORCPT ); Thu, 12 Jan 2023 17:09:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240130AbjALWJE (ORCPT ); Thu, 12 Jan 2023 17:09:04 -0500 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 32D953FA3D; Thu, 12 Jan 2023 13:59:40 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.97,212,1669042800"; d="scan'208";a="146137088" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 13 Jan 2023 06:59:39 +0900 Received: from localhost.localdomain (unknown [10.226.92.132]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 8C1FF400A8BB; Fri, 13 Jan 2023 06:59:36 +0900 (JST) From: Biju Das To: Mathias Nyman , Greg Kroah-Hartman Cc: Biju Das , linux-usb@vger.kernel.org, Yoshihiro Shimoda , Geert Uytterhoeven , Fabrizio Castro , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 07/12] usb: host: xhci-plat: Improve clock handling in probe() Date: Thu, 12 Jan 2023 21:59:01 +0000 Message-Id: <20230112215906.494394-8-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230112215906.494394-1-biju.das.jz@bp.renesas.com> References: <20230112215906.494394-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It is always better to acquire all the clock resources first and then do the clock operations. This patch acquires all the optional clocks first and then calls corresponding prepare_enable(). There is no functional change. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v1->v2: * Added Rb tag from Geert. --- drivers/usb/host/xhci-plat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 5fb55bf19493..11b3a0d6722d 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -257,16 +257,16 @@ static int xhci_plat_probe(struct platform_device *pdev) goto put_hcd; } - ret = clk_prepare_enable(xhci->reg_clk); - if (ret) - goto put_hcd; - xhci->clk = devm_clk_get_optional(&pdev->dev, NULL); if (IS_ERR(xhci->clk)) { ret = PTR_ERR(xhci->clk); - goto disable_reg_clk; + goto put_hcd; } + ret = clk_prepare_enable(xhci->reg_clk); + if (ret) + goto put_hcd; + ret = clk_prepare_enable(xhci->clk); if (ret) goto disable_reg_clk;