From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 093193D3012; Thu, 15 Jan 2026 17:57:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768499834; cv=none; b=sq1sZG1kuxpotA3fQFbmM02ZpgWaFZ0FfCSS+qHNEZmYtxQUOHC2iIrbRSvLeucT1gnAAYIN4DVRyygx7OqIhLYrYI11cHESu4Jiky8AuNnnTVwSVL4RnGWDTNu2+KC2C2F0iewNndLPuAjX7+DKcx/PVVqZ/UxlKjxy8RZ7ZoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768499834; c=relaxed/simple; bh=bShhk6KSVMpZzL5Yu90B8ooQmZzpYbrWYcFuIfdBrUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NWky8xI8MrBWqaDfaDpQgSwxsWUVUw9WF15CwrbAZ8hVVNPUKwQtX0PjP7t3pK6I0DYcdwhiZm3Ut8u39a3K0DLUh9e2+zP34CrnTaqB/R5lVd1hX0th533CEK1RdKuznh8Axxma2Ybgvi2j+ibCATVXNEn9zdbWu08H+uaPlLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=E4mkaRVs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="E4mkaRVs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CB35C116D0; Thu, 15 Jan 2026 17:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768499833; bh=bShhk6KSVMpZzL5Yu90B8ooQmZzpYbrWYcFuIfdBrUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4mkaRVsm6JblFulGeGrTPdoumEy5bAL0ZAXbbONpIdeTX8Zjzf2WiB+/nfauEHn4 ONNaJdmrVrK0ZnEgL0FiZ9bCF5KU+4e11Ko8SOHIMt3I7sC+6/jAUlOkdHPKNMjJSg wcK4KhlB0aqc1SwGYeIRgdhnydS53mF5pMHgnrL4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhang Zekun , Alan Stern , Sasha Levin Subject: [PATCH 5.10 365/451] usb: ohci-nxp: Use helper function devm_clk_get_enabled() Date: Thu, 15 Jan 2026 17:49:26 +0100 Message-ID: <20260115164244.112054486@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115164230.864985076@linuxfoundation.org> References: <20260115164230.864985076@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhang Zekun [ Upstream commit c146ede472717f352b7283a525bd9a1a2b15e2cf ] devm_clk_get() and clk_prepare_enable() can be replaced by helper function devm_clk_get_enabled(). Let's use devm_clk_get_enabled() to simplify code and avoid calling clk_disable_unprepare(). Signed-off-by: Zhang Zekun Acked-by: Alan Stern Link: https://lore.kernel.org/r/20240902123020.29267-3-zhangzekun11@huawei.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b4c61e542faf ("usb: ohci-nxp: fix device leak on probe failure") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-nxp.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -51,8 +51,6 @@ static struct hc_driver __read_mostly oh static struct i2c_client *isp1301_i2c_client; -static struct clk *usb_host_clk; - static void isp1301_configure_lpc32xx(void) { /* LPC32XX only supports DAT_SE0 USB mode */ @@ -155,6 +153,7 @@ static int ohci_hcd_nxp_probe(struct pla struct resource *res; int ret = 0, irq; struct device_node *isp1301_node; + struct clk *usb_host_clk; if (pdev->dev.of_node) { isp1301_node = of_parse_phandle(pdev->dev.of_node, @@ -180,26 +179,20 @@ static int ohci_hcd_nxp_probe(struct pla } /* Enable USB host clock */ - usb_host_clk = devm_clk_get(&pdev->dev, NULL); + usb_host_clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(usb_host_clk)) { - dev_err(&pdev->dev, "failed to acquire USB OHCI clock\n"); + dev_err(&pdev->dev, "failed to acquire and start USB OHCI clock\n"); ret = PTR_ERR(usb_host_clk); goto fail_disable; } - ret = clk_prepare_enable(usb_host_clk); - if (ret < 0) { - dev_err(&pdev->dev, "failed to start USB OHCI clock\n"); - goto fail_disable; - } - isp1301_configure(); hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd) { dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); ret = -ENOMEM; - goto fail_hcd; + goto fail_disable; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -230,8 +223,6 @@ static int ohci_hcd_nxp_probe(struct pla ohci_nxp_stop_hc(); fail_resource: usb_put_hcd(hcd); -fail_hcd: - clk_disable_unprepare(usb_host_clk); fail_disable: isp1301_i2c_client = NULL; return ret; @@ -244,7 +235,6 @@ static int ohci_hcd_nxp_remove(struct pl usb_remove_hcd(hcd); ohci_nxp_stop_hc(); usb_put_hcd(hcd); - clk_disable_unprepare(usb_host_clk); isp1301_i2c_client = NULL; return 0;