From nobody Sat Feb 7 17:54:57 2026 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 C81BE257852; Thu, 18 Dec 2025 14:20:46 +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=1766067646; cv=none; b=k0MtO8VOhH+uNP3RyQvdST31kZjKy5KUtXIAshdf6C6bqsUn9cTtEZyI6Xlq6jFiyCO4GQJPC8c3yR7NZJ9fn9DIGyPCYQmD2/iSPBYyW8WJNjgw3rliCtq0FnztYqSqynWR9fgCFncUIoANFlWTC6+6dDNl11gzC2rTlHDk5ZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766067646; c=relaxed/simple; bh=n1EbVAM7CU4kmC42XnjfjvQExlpZouOeA9C4bDSbnCk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kxjI6bL48MdjKHcU9sMb4JKlFdwyW8shDIFoaDnos6Tox+eJbna7Rbc2ZZM/zM8wiolChQhKfNvLODccON1WfWtYV9jv+pFRHyi7Mg1oruK/DG37fP4pOEA4b551UHsBmwsV/9SL2+1vLMf4mnyUOvvZ9Z6Th2NBCGPpv/nFVOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mH4mhZSy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mH4mhZSy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 818C6C116C6; Thu, 18 Dec 2025 14:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766067646; bh=n1EbVAM7CU4kmC42XnjfjvQExlpZouOeA9C4bDSbnCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mH4mhZSyKLO5PFKSsDNX04SyNYfZTlQ5ApFSKS0+GQKXCjf0xW87qp/Nw+8CP9pYS eqIfrC2M+MOZ8AwvPwd2hrRV5Zkxb1/D39s3IhNobVyY1wgI4tOG6pkficJpI+joKR Jjq6kIuJyJU4lPM8qO9WBMaSE7Mpfy7YSsVIef/9kONKGV7Agwji1Ouab2G8Bbcy4k +b1wFDZJCfxX1iPNvwEGfHgKMZNDn1lbDqkPgST5K8EZadkGeoF8x3hIh8qHw9bzmH DmsjFw+Zzu3Hrlgnd6nmF6kkV1H/gTrd3aDEoPCcyy2Q/2zAtQyMWWNAT5ZqEDD4V0 P+lBPvF9l2uuw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWEs0-000000001YG-2rLt; Thu, 18 Dec 2025 15:20:44 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Vladimir Zapolskiy , Piotr Wojtaszczyk , Alan Stern , Ma Ke , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 1/5] usb: gadget: lpc32xx_udc: fix clock imbalance in error path Date: Thu, 18 Dec 2025 15:19:41 +0100 Message-ID: <20251218141945.5884-2-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218141945.5884-1-johan@kernel.org> References: <20251218141945.5884-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A recent change fixing a device reference leak introduced a clock imbalance by reusing an error path so that the clock may be disabled before having been enabled. Note that the clock framework allows for passing in NULL clocks so there is no risk for a NULL pointer dereference. Also drop the bogus I2C client NULL check added by the offending commit as the pointer has already been verified to be non-NULL. Fixes: c84117912bdd ("USB: lpc32xx_udc: Fix error handling in probe") Cc: stable@vger.kernel.org Cc: Ma Ke Signed-off-by: Johan Hovold --- drivers/usb/gadget/udc/lpc32xx_udc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/= lpc32xx_udc.c index 73c0f28a8585..a962d4294fbe 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -3020,7 +3020,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) pdev->dev.dma_mask =3D &lpc32xx_usbd_dmamask; retval =3D dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); if (retval) - goto i2c_fail; + goto err_put_client; =20 udc->board =3D &lpc32xx_usbddata; =20 @@ -3040,7 +3040,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) udc->udp_irq[i] =3D platform_get_irq(pdev, i); if (udc->udp_irq[i] < 0) { retval =3D udc->udp_irq[i]; - goto i2c_fail; + goto err_put_client; } } =20 @@ -3048,7 +3048,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) if (IS_ERR(udc->udp_baseaddr)) { dev_err(udc->dev, "IO map failure\n"); retval =3D PTR_ERR(udc->udp_baseaddr); - goto i2c_fail; + goto err_put_client; } =20 /* Get USB device clock */ @@ -3056,14 +3056,14 @@ static int lpc32xx_udc_probe(struct platform_device= *pdev) if (IS_ERR(udc->usb_slv_clk)) { dev_err(udc->dev, "failed to acquire USB device clock\n"); retval =3D PTR_ERR(udc->usb_slv_clk); - goto i2c_fail; + goto err_put_client; } =20 /* Enable USB device clock */ retval =3D clk_prepare_enable(udc->usb_slv_clk); if (retval < 0) { dev_err(udc->dev, "failed to start USB device clock\n"); - goto i2c_fail; + goto err_put_client; } =20 /* Setup deferred workqueue data */ @@ -3165,9 +3165,10 @@ static int lpc32xx_udc_probe(struct platform_device = *pdev) dma_free_coherent(&pdev->dev, UDCA_BUFF_SIZE, udc->udca_v_base, udc->udca_p_base); i2c_fail: - if (udc->isp1301_i2c_client) - put_device(&udc->isp1301_i2c_client->dev); clk_disable_unprepare(udc->usb_slv_clk); +err_put_client: + put_device(&udc->isp1301_i2c_client->dev); + dev_err(udc->dev, "%s probe failed, %d\n", driver_name, retval); =20 return retval; @@ -3195,10 +3196,9 @@ static void lpc32xx_udc_remove(struct platform_devic= e *pdev) dma_free_coherent(&pdev->dev, UDCA_BUFF_SIZE, udc->udca_v_base, udc->udca_p_base); =20 - if (udc->isp1301_i2c_client) - put_device(&udc->isp1301_i2c_client->dev); - clk_disable_unprepare(udc->usb_slv_clk); + + put_device(&udc->isp1301_i2c_client->dev); } =20 #ifdef CONFIG_PM --=20 2.51.2 From nobody Sat Feb 7 17:54:57 2026 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 C822825CC6C; Thu, 18 Dec 2025 14:20:46 +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=1766067646; cv=none; b=N2RQ3gfJ6IAOXQBKewa3WdJ+cARO7HaMuVUxwpwaH7LmaB99+3sjPyyceacfOHi3kPeo+4Vhog4jvzU61YOWKRf8OV6gXdYQRB9PGwKeuVseZF+UI+e2lKCscw+OCGnfWi6D0BymXFUShx+ksuFmtOdwV4nFhcYPwkwtJohtaeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766067646; c=relaxed/simple; bh=QG3lO4v3c5APo1lagsAKwB1p/Va6baGw435WlXG9FN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MJzqeab7MTaeRb3YGkiRoVYiK0oN/vUMVAzNoQprLBejIOTeNM+B2+i7R8gP6xZisqVjSP1+jgRLVy/zGxmPMNp0yiV3MRWN/Nq7rERAxzbsS9m23BGdhMCU6I8ynVy29bGYmiVkDD5I9ShmPkOVQguFsy1X0iL1Yxl23ovSRlE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DqzAzGZg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DqzAzGZg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 877EEC116D0; Thu, 18 Dec 2025 14:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766067646; bh=QG3lO4v3c5APo1lagsAKwB1p/Va6baGw435WlXG9FN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqzAzGZg4faHk1d3cWaNjbVUbxcVcCGJUCZMDqVqesOGcJH9RHRq0pYt/ThQ55pVN 3ApJdLgc1KjhF9VG+BeWjM0fUjbN4PeRtqGfgSw8Iy15QY+EpBNP/Psb51hoSEVnxB ifktCGYO/UO0ddiUsCV+fJaQfx3ppdLpVTiQkfnuGRVlQIztQoM7HSjNzNhMlekEns 6Wmc9wnom+uuWxdJWZAYS4MrVV8uAcDHiRXUwhcy7EsB4xu3+in5SWySyfRrcw1r4s 3memAMC2ncwATMQfYeGWm/XgHK3kxTo1WeGWkWvYPNz3ZrPCQJK1lB55lUrYR/YOEz tU1k0aosRW+kA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWEs0-000000001YI-3HvT; Thu, 18 Dec 2025 15:20:44 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Vladimir Zapolskiy , Piotr Wojtaszczyk , Alan Stern , Ma Ke , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 2/5] usb: phy: isp1301: fix non-OF device reference imbalance Date: Thu, 18 Dec 2025 15:19:42 +0100 Message-ID: <20251218141945.5884-3-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218141945.5884-1-johan@kernel.org> References: <20251218141945.5884-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A recent change fixing a device reference leak in a UDC driver introduced a potential use-after-free in the non-OF case as the isp1301_get_client() helper only increases the reference count for the returned I2C device in the OF case. Increment the reference count also for non-OF so that the caller can decrement it unconditionally. Note that this is inherently racy just as using the returned I2C device is since nothing is preventing the PHY driver from being unbound while in use. Fixes: c84117912bdd ("USB: lpc32xx_udc: Fix error handling in probe") Cc: stable@vger.kernel.org Cc: Ma Ke Signed-off-by: Johan Hovold --- drivers/usb/phy/phy-isp1301.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c index f9b5c411aee4..2940f0c84e1b 100644 --- a/drivers/usb/phy/phy-isp1301.c +++ b/drivers/usb/phy/phy-isp1301.c @@ -149,7 +149,12 @@ struct i2c_client *isp1301_get_client(struct device_no= de *node) return client; =20 /* non-DT: only one ISP1301 chip supported */ - return isp1301_i2c_client; + if (isp1301_i2c_client) { + get_device(&isp1301_i2c_client->dev); + return isp1301_i2c_client; + } + + return NULL; } EXPORT_SYMBOL_GPL(isp1301_get_client); =20 --=20 2.51.2 From nobody Sat Feb 7 17:54:57 2026 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 C80B423D7FF; Thu, 18 Dec 2025 14:20:46 +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=1766067646; cv=none; b=kLBjW9BI2ekgAgbwSY7o6ibPfgDIpwFPlp2JW/d4MUYKbCUghp+0Y8MT+3MHffX2d6YYGkqjQh7wQQXl09nO3tRFkrmaX3lURTCCZcL5bYQigvY7yRWqCA6kE+ucYqEYWomxIQcIOx/3g6CwxddXqWNhHSj1rKqmraLmHj7SokE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766067646; c=relaxed/simple; bh=FhwZAwxk5GSdjJw5kwHI4Ojzyh/ABP7YaR9bgf68cMY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GUWKdwcpoL1g/pNskdbUgKes49bVtC8wDUAw0SleRDMnLNuGh4rh+n9clMQ2BQSSlbJm5lCz7zaCfKxBYOdSiBK0IihfICAUVV6u/0ZtCn6+zyPQPIYDeUa4lAgFkXGi21hT5bMzkK4+3Vyy7ojYU0msOc9vZLWZOOfyGY85PP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L1qogwPG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L1qogwPG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89BC1C19422; Thu, 18 Dec 2025 14:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766067646; bh=FhwZAwxk5GSdjJw5kwHI4Ojzyh/ABP7YaR9bgf68cMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1qogwPGzBaD9hwd1h9D1mHjLUEBpD5l1/ZK3BjjYX3SpxgvGhse9RArBzhNoWXO7 0GmQbr30h9PB0Zc/m63Yn1iDySyU1z7acpVCnoKNMI/cZwKKlsoOeOy40Wo9VRIMm2 PxT28n4IT2/7/j54z2fjqFASMRbcxR1jJUc9CVYGsOQAuYqYctyXfxb7QY0wbt4Fqp Knlr46/nLtmrUVmmPCyfeqDySD3YkVf3XJwmNgtquvRSBPjEGL1QJIFyYwZnV0tFJI Q+pKBm5109VsuSJgW/2gd+He05jVJ1ujP5gw8urqnUbKa/owbtAfk9KVrU6SBVYFY+ /ztM9f1rQENxA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWEs0-000000001YL-3cGR; Thu, 18 Dec 2025 15:20:44 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Vladimir Zapolskiy , Piotr Wojtaszczyk , Alan Stern , Ma Ke , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 3/5] usb: ohci-nxp: fix device leak on probe failure Date: Thu, 18 Dec 2025 15:19:43 +0100 Message-ID: <20251218141945.5884-4-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218141945.5884-1-johan@kernel.org> References: <20251218141945.5884-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make sure to drop the reference taken when looking up the PHY I2C device during probe on probe failure (e.g. probe deferral) and on driver unbind. Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver") Cc: stable@vger.kernel.org # 3.5 Reported-by: Ma Ke Link: https://lore.kernel.org/lkml/20251117013428.21840-1-make24@iscas.ac.c= n/ Signed-off-by: Johan Hovold --- drivers/usb/host/ohci-nxp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index 24d5a1dc5056..9a05828bbba1 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -169,13 +169,13 @@ static int ohci_hcd_nxp_probe(struct platform_device = *pdev) =20 ret =3D dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (ret) - goto fail_disable; + goto err_put_client; =20 dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name); if (usb_disabled()) { dev_err(&pdev->dev, "USB is disabled\n"); ret =3D -ENODEV; - goto fail_disable; + goto err_put_client; } =20 /* Enable USB host clock */ @@ -183,7 +183,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) if (IS_ERR(usb_host_clk)) { dev_err(&pdev->dev, "failed to acquire and start USB OHCI clock\n"); ret =3D PTR_ERR(usb_host_clk); - goto fail_disable; + goto err_put_client; } =20 isp1301_configure(); @@ -192,7 +192,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) if (!hcd) { dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); ret =3D -ENOMEM; - goto fail_disable; + goto err_put_client; } =20 hcd->regs =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); @@ -222,7 +222,8 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) ohci_nxp_stop_hc(); fail_resource: usb_put_hcd(hcd); -fail_disable: +err_put_client: + put_device(&isp1301_i2c_client->dev); isp1301_i2c_client =3D NULL; return ret; } @@ -234,6 +235,7 @@ static void ohci_hcd_nxp_remove(struct platform_device = *pdev) usb_remove_hcd(hcd); ohci_nxp_stop_hc(); usb_put_hcd(hcd); + put_device(&isp1301_i2c_client->dev); isp1301_i2c_client =3D NULL; } =20 --=20 2.51.2 From nobody Sat Feb 7 17:54:57 2026 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 E4D36260566; Thu, 18 Dec 2025 14:20:46 +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=1766067647; cv=none; b=u7S/ZxXRmCoELRv16gjgnR1av9HJoI5GsTloyNaqCRSjDnQN/JYM94mrqLLlbg4jCosYbwU5uXxp5HZ/APk9/e/+kq5+Aonaz4fPrph1UjJMJtcceRIj/t/O06xW6vL49qMANteSiMA7hxibJOw1JrQ4PRrkwRv9nXQ14l01A3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766067647; c=relaxed/simple; bh=ZoOMPbu15uszbv6DNmVkTA9G5hpJWLOSYd86M5kLijs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZatylDpJTE522zMVzj/NyjPB4oWJOV9XDCapNx0lgaWxVXnEhJxCUmLNNvTziyuEd5+j5FZKjnb54X0gz3avfRfFad0rBtM8xg/w9EM61aBOW3bIBP1rAJ+KGid1sUPCNK74al1xmtNx1Cx9HLwIut+3NxrhI8vJueknwadJ75A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=up+ynGcy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="up+ynGcy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B941C19421; Thu, 18 Dec 2025 14:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766067646; bh=ZoOMPbu15uszbv6DNmVkTA9G5hpJWLOSYd86M5kLijs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=up+ynGcyvTia1cbBevKvKgN+sJ0JztDcjqoXnmXolQIbdGojikh4G4M3vzwoPIKub tLN35WOwM9b3e5CYr8n2evL23Ly+FWYZ5VKM0E/GTgOupbr8aOYB6F6SazFGpdnUM3 iB3Jfm/jj0/3CKZmM+PVJygQo+vPLW8pem5ADUQ7gCMbSLtNwVOOdpBSaKiKi7pEJL pCTs2EJxAP2O5+ivdm+Od8g53DOh3crkQAwURCIav0VbeHR3C7GY5UqjEvSmjU8Hk1 8/RvAWgFbUJ3zBLiM0qvc+omFK6YUVIBuxmmLd+zAeleUfPl/OXcv3nwJScmyk+Hjl CMNVqepCL9IoA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWEs0-000000001YO-42Jo; Thu, 18 Dec 2025 15:20:44 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Vladimir Zapolskiy , Piotr Wojtaszczyk , Alan Stern , Ma Ke , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/5] usb: gadget: lpc32xx_udc: clean up probe error labels Date: Thu, 18 Dec 2025 15:19:44 +0100 Message-ID: <20251218141945.5884-5-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218141945.5884-1-johan@kernel.org> References: <20251218141945.5884-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Error labels should be named after what they do rather than after from where they are jumped to. Rename the probe error labels for consistency and to improve readability. Signed-off-by: Johan Hovold --- drivers/usb/gadget/udc/lpc32xx_udc.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/= lpc32xx_udc.c index a962d4294fbe..83c7e243dcf9 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -3084,7 +3084,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) if (!udc->udca_v_base) { dev_err(udc->dev, "error getting UDCA region\n"); retval =3D -ENOMEM; - goto i2c_fail; + goto err_disable_clk; } udc->udca_p_base =3D dma_handle; dev_dbg(udc->dev, "DMA buffer(0x%x bytes), P:0x%08x, V:0x%p\n", @@ -3097,7 +3097,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) if (!udc->dd_cache) { dev_err(udc->dev, "error getting DD DMA region\n"); retval =3D -ENOMEM; - goto dma_alloc_fail; + goto err_free_dma; } =20 /* Clear USB peripheral and initialize gadget endpoints */ @@ -3111,14 +3111,14 @@ static int lpc32xx_udc_probe(struct platform_device= *pdev) if (retval < 0) { dev_err(udc->dev, "LP request irq %d failed\n", udc->udp_irq[IRQ_USB_LP]); - goto irq_req_fail; + goto err_destroy_pool; } retval =3D devm_request_irq(dev, udc->udp_irq[IRQ_USB_HP], lpc32xx_usb_hp_irq, 0, "udc_hp", udc); if (retval < 0) { dev_err(udc->dev, "HP request irq %d failed\n", udc->udp_irq[IRQ_USB_HP]); - goto irq_req_fail; + goto err_destroy_pool; } =20 retval =3D devm_request_irq(dev, udc->udp_irq[IRQ_USB_DEVDMA], @@ -3126,7 +3126,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) if (retval < 0) { dev_err(udc->dev, "DEV request irq %d failed\n", udc->udp_irq[IRQ_USB_DEVDMA]); - goto irq_req_fail; + goto err_destroy_pool; } =20 /* The transceiver interrupt is used for VBUS detection and will @@ -3137,7 +3137,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) if (retval < 0) { dev_err(udc->dev, "VBUS request irq %d failed\n", udc->udp_irq[IRQ_USB_ATX]); - goto irq_req_fail; + goto err_destroy_pool; } =20 /* Initialize wait queue */ @@ -3146,7 +3146,7 @@ static int lpc32xx_udc_probe(struct platform_device *= pdev) =20 retval =3D usb_add_gadget_udc(dev, &udc->gadget); if (retval < 0) - goto add_gadget_fail; + goto err_destroy_pool; =20 dev_set_drvdata(dev, udc); device_init_wakeup(dev, 1); @@ -3158,13 +3158,12 @@ static int lpc32xx_udc_probe(struct platform_device= *pdev) dev_info(udc->dev, "%s version %s\n", driver_name, DRIVER_VERSION); return 0; =20 -add_gadget_fail: -irq_req_fail: +err_destroy_pool: dma_pool_destroy(udc->dd_cache); -dma_alloc_fail: +err_free_dma: dma_free_coherent(&pdev->dev, UDCA_BUFF_SIZE, udc->udca_v_base, udc->udca_p_base); -i2c_fail: +err_disable_clk: clk_disable_unprepare(udc->usb_slv_clk); err_put_client: put_device(&udc->isp1301_i2c_client->dev); --=20 2.51.2 From nobody Sat Feb 7 17:54:57 2026 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 2DE6529B224; Thu, 18 Dec 2025 14:20:46 +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=1766067648; cv=none; b=q4+CwgjRl2LLZH0qhMZik6ntXUns4pFhGWIOFph/iOtPdjdY8W+OKBICqAJjOVxq9UIvRhvBbRSwi/WyZWEozVD0L1hygh3KBolhwRRemjbdA/GSsGD44NWz5RWU1MsSEXWObnnarDF8XEWALVNA3PSmWEPB8l7jS7wF6OtttUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766067648; c=relaxed/simple; bh=KfWqZQnauiqwFE7v8YKMYdmDoE/S3EJ0zM4G0/EWpHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AHPm5bIO9qxpkSdN9oi+yJUc6CXjv7DJE83gsNovVUzFZRd+JjIo8WKWvMevbTqvy6BzTb9/1XEw9o6txc5jlPwMzkZoYLnkAK9ylDy2YpP8wAuC91qT+vWV8Yqs1Rrgv1QBE1d6y9XpdYKec2dG4dhmvyjNlDrqTCYMegGk+Bk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hwjlvC7n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hwjlvC7n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E3D3C19424; Thu, 18 Dec 2025 14:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766067646; bh=KfWqZQnauiqwFE7v8YKMYdmDoE/S3EJ0zM4G0/EWpHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hwjlvC7ns3ixwufX737E7YMyx7F3jfRBHTgzkHxqH6NgDSZAI6ZwFaT9Z9rdXq7RR AIOOHfxaOrYqz8vZ28YIdybMiO7YuVvm+cUYEMvVLtY/8tUTHIHj3r3Sv/4dU1xqjA 64nBWbTyfPKmiqNDE2vQqs6k02TUmA4X/EZ4dfjptCoWW7Qrxt3hKQEy5jJDrNskmr di7nlOUrp0hRumtcrPOVoTl4Hi0UoCEl/LW216Xz0lgIson0300Aq0+oasn8Lw6HET 9I+7Wnur/K1fR4H0Ro8dqicetY6TnNqZlfo2Nyngx85DnouwVAtJ0tMw9CY8eEj3Iz O0kC5FKwfPnAg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWEs1-000000001YR-0Db3; Thu, 18 Dec 2025 15:20:45 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Vladimir Zapolskiy , Piotr Wojtaszczyk , Alan Stern , Ma Ke , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 5/5] usb: ohci-nxp: clean up probe error labels Date: Thu, 18 Dec 2025 15:19:45 +0100 Message-ID: <20251218141945.5884-6-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218141945.5884-1-johan@kernel.org> References: <20251218141945.5884-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Error labels should be named after what they do rather than after from where they are jumped to. Rename the probe error labels for consistency and to improve readability. Signed-off-by: Johan Hovold --- drivers/usb/host/ohci-nxp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index 9a05828bbba1..7663f2aa35e9 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -198,7 +198,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) hcd->regs =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(hcd->regs)) { ret =3D PTR_ERR(hcd->regs); - goto fail_resource; + goto err_put_hcd; } hcd->rsrc_start =3D res->start; hcd->rsrc_len =3D resource_size(res); @@ -206,7 +206,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) irq =3D platform_get_irq(pdev, 0); if (irq < 0) { ret =3D -ENXIO; - goto fail_resource; + goto err_put_hcd; } =20 ohci_nxp_start_hc(); @@ -220,7 +220,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) } =20 ohci_nxp_stop_hc(); -fail_resource: +err_put_hcd: usb_put_hcd(hcd); err_put_client: put_device(&isp1301_i2c_client->dev); --=20 2.51.2