From nobody Sat Feb 7 17:55:06 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 C1D7934F26F; Thu, 18 Dec 2025 15:37:24 +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=1766072244; cv=none; b=JL4rkOHqz8iL1e45B87ORK8ihC/aSOGUMG2gWG1ymXoqli6CnvuLsLuS/e5oXihwV8F5Lue5Cs5KBpy1178qPWlGnsX/5aQCqLdi7+RpXgS9cCppvp5cT4Ygz2m1zqUs/8MiX585bBv90l8SeGNlTWapS82I/T6tpkF5K/jhMTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766072244; c=relaxed/simple; bh=n1EbVAM7CU4kmC42XnjfjvQExlpZouOeA9C4bDSbnCk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JM+IiO+Nn/7xHwgvwiPx1PkPx6Rt9I9EVFvSPSanZ1pkHO9Cjul4ROMW1tr+Ia9i/JC1haaQOofZpQ2yqZwr9xvyY0rVfqkPVSKOZov6DQuMcKzok79VbQwdl6vv40txJ4GRwlHg0MxOwu30arHp4uyJ5Yn6/A8kQmtO+9zNqBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ULoPjDa/; 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="ULoPjDa/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ED78C4CEFB; Thu, 18 Dec 2025 15:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766072244; bh=n1EbVAM7CU4kmC42XnjfjvQExlpZouOeA9C4bDSbnCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULoPjDa/9dVXVV4Of3BLpEhw6vHhHPmcNrVSB14F67XX3QXFEMNFDC6NWUzisUXIo rdenMVLEdit9FuEortHaJ0FkWYhDwB8vz80NqNGs4CPV25o9Q02F4p7W9SaFmkVgYB /su6UQjg1xOtSKzCgEjsgSjXCrdqV8Y+sCfLf2f5bioOXlqEZur3gzol9zuZNJBwaE 58xY+kgrvnqTeQK/A8Tdzr5P0zzTmftXPlLEl4odp5rs1GcS6cxW/5If7AVVQNBEQw HwaSJUD0ZjYVQI1E1zpftY4p9SLekq6p10SNQj54v2Qy7h9xOkrCHdeueQ+ERF1RA6 AgVVf9B3mjOaw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWG4A-00000000567-45pg; Thu, 18 Dec 2025 16:37:23 +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 v2 1/5] usb: gadget: lpc32xx_udc: fix clock imbalance in error path Date: Thu, 18 Dec 2025 16:35:15 +0100 Message-ID: <20251218153519.19453-2-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218153519.19453-1-johan@kernel.org> References: <20251218153519.19453-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 Reviewed-by: Vladimir Zapolskiy --- 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:55:06 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 C1CF534F253; Thu, 18 Dec 2025 15:37:24 +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=1766072244; cv=none; b=GPihLR0t6xYZdcG+iSSB5uzZAqdft8l5RwI3Ad9B3a+WPRc9cuCLWfB37FwAvW0fB/mnjxw3+LsUzOA2DePEiI2DnngMmjaCEcyyxDB+dZaL1hGyGh+JRMKpg1lSM1UR23VfUYiUVCpC7leLD2rUWECAg36UKycNwEqF+/eU6DY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766072244; c=relaxed/simple; bh=QG3lO4v3c5APo1lagsAKwB1p/Va6baGw435WlXG9FN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ovTazVcSMmkWBZS0fYjd64Htiv+uRLRyO1LUS8GJSapJ5ZZksFwBywcqkw2/HL1TkcoDzyxdtoIksZqFNiz5k4BFDPFOWfpK4gcbvqSnthc7CWADlrKvjf/pOdk9vY8Q9NTeuoKc/5mEmHLFDsa+CTSuTu/ro+rKabQoVBM/tQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YqJBFnQt; 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="YqJBFnQt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A48C116C6; Thu, 18 Dec 2025 15:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766072244; bh=QG3lO4v3c5APo1lagsAKwB1p/Va6baGw435WlXG9FN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YqJBFnQtn1R46lfrqM1RigXo6fVaYT8HfBwrzgmfWUAT1w+8iaIRfL4F1DGQ15G9v gIiDMYi9HjdowC8hjlUCqLiB27d3EmQdD22LV5Fz0DSYIzvJ+VZv2yI90pk2DjvWIo 4dQsPmvost6TQZsVNMzaezJIcqMWGsB4qTuod9Y1B5yP0vcUWAXKe8cFJpX2hIL6y7 qyCN2BIHgEi9c1JR9PhnBEtSCmVZkAfglcmV4C+shs4PfOWElfLlx3WVe4Az3SJ890 T8WAH5ijLoNO836aouWFqD7zgL7vTj4yWt0zbGqVryjt+iCWuClGASwOS1NRsd4m5a xraN90xe+uthg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWG4B-00000000569-0IkR; Thu, 18 Dec 2025 16:37:23 +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 v2 2/5] usb: phy: isp1301: fix non-OF device reference imbalance Date: Thu, 18 Dec 2025 16:35:16 +0100 Message-ID: <20251218153519.19453-3-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218153519.19453-1-johan@kernel.org> References: <20251218153519.19453-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 Reviewed-by: Vladimir Zapolskiy --- 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:55:06 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 347BB34F482; Thu, 18 Dec 2025 15:37:24 +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=1766072245; cv=none; b=XM18mfS7noJnGQ7fBViGvw3Z/vd5vIBkUvk+4Ov5olGdQlXpgnzAwuoc2jvMkuVGNbkJ2O+ZoHXwfwoVhm6d+5/AW2Rv14yYZKg0balJuy1dOgOxuL/SUPZZG4mGB7L1GOSuSUWOOv2V3CdmPZIREevyW03Lgo6LIE44m+W4VC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766072245; c=relaxed/simple; bh=Pez/lqPEVsmpWvjU1ySBtrqLxe0+pAjZm/LpmZXtL6A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jt5umA5xolg9quRY1PdbjykjolXUiDhxLvO0olskGFAN3+dBZ+fSzF+OGNrjwXVjKOGut5qGnT3Vo+GAh4yekZR7K8pU8e1R6+/hA8KvFKC5BmMfeyv14plOKeVf8mbi5BT3kA3FerYqa71aL/UNdkDn9cTtmEEp860zIInsAnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GKMAILWi; 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="GKMAILWi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C53FEC19423; Thu, 18 Dec 2025 15:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766072244; bh=Pez/lqPEVsmpWvjU1ySBtrqLxe0+pAjZm/LpmZXtL6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKMAILWiU3IvfH5WvUVC9wwsOcZzJcpYZ7idEO0ybRs1ND/nUsfL7Se9teq135xPA wcJK1unOxTbSwHiUe30j0oLVHIs8ei6I3rosPYd6gh8XSARn3ZDFhqJyLKCIuBCYz7 fyoYcZLIrz/5XpxjA1FXGv5f0ewGWQOK2vgZwnILrE/yQfzEi4jWBu4Q2lH+fuStXG j20RWRbTbdxF+HTcTwwo0/H5V4wxgHsUlnk/5uQEXOImBywvcpDW7tX5u+e1GYWVTa +vjTRIs+5ZBVqKD8tL3aCKLgOMAYO/4XnRrtP7a77daj42Q+fUgbQ3EWb2vYU7gMSz n8m8Mo1yoZCjg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWG4B-0000000056C-0g0g; Thu, 18 Dec 2025 16:37:23 +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 v2 3/5] usb: ohci-nxp: fix device leak on probe failure Date: Thu, 18 Dec 2025 16:35:17 +0100 Message-ID: <20251218153519.19453-4-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218153519.19453-1-johan@kernel.org> References: <20251218153519.19453-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 Acked-by: Alan Stern Reviewed-by: Vladimir Zapolskiy --- drivers/usb/host/ohci-nxp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index 24d5a1dc5056..509ca7d8d513 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -223,6 +223,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) fail_resource: usb_put_hcd(hcd); fail_disable: + 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:55:06 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 349A934F483; Thu, 18 Dec 2025 15:37:25 +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=1766072245; cv=none; b=dIXFZLLvcq6kNHecOYtRTl9siu39RpxwG6p2Vw/7TtmHsaDMgFbPdWqnUR+JkfRy6LBwiQkVH3k77JQyegj2fPXWHE6NtOdDnZyU/kdYK5fI2iRTXAH3IzX35Rnx6ewvmdHiyD8bKHUeeimWPKDVT4/p9coLP0CPXCbBGhymHyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766072245; c=relaxed/simple; bh=ZoOMPbu15uszbv6DNmVkTA9G5hpJWLOSYd86M5kLijs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uqD2MtpKrMLTGUbbieEKoMa4EpYw1cX/inEe1LT8PR9VU5+TDQsPHGYU/CQ6D7OlrNAuHhQrdQy4tpvLohoOUHNbZWZv69RXFuIKyD6h8aeYUhWIn+GORZcKRc5ZMD/uresAfwW4Y2UvQGJusKWnNEl4mbV5VrDDTOL2EyO5FgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ARrXLmth; 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="ARrXLmth" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4EBFC116B1; Thu, 18 Dec 2025 15:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766072244; bh=ZoOMPbu15uszbv6DNmVkTA9G5hpJWLOSYd86M5kLijs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ARrXLmthoQzcPVXhaYLeXGKQvRncwxFmyVK2BOyfWGzgs/SkZOtdjcrsti/dLx+2V EWbAOFUp+5/0nF32HIHUy7n4efVG3UOg8otc8h0tHrHJqI5zxR4e1gc/QEjJOPnSa5 cyt33ElQk/MogBjDNRaG4mDu6TiUVC/t20rcxA6zJT7uPSrGo/r76G5WhAgaz9Yj3h gkL3p1cy9lRB5reF3yZSmwLxrYIhYxp+54nQIIS1x0r3Ukq34nidYEjxBsV31JIC7I bvouw5wTVRZTQoHCYIz1Q0OTrKGvtKcotDRqUDXp4SCmGROOekcZJMCOK1QUaFJeGN ZsIOBtX0PN3zQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWG4B-0000000056F-16Ah; Thu, 18 Dec 2025 16:37:23 +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 v2 4/5] usb: gadget: lpc32xx_udc: clean up probe error labels Date: Thu, 18 Dec 2025 16:35:18 +0100 Message-ID: <20251218153519.19453-5-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218153519.19453-1-johan@kernel.org> References: <20251218153519.19453-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 Reviewed-by: Vladimir Zapolskiy --- 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:55:06 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 346DF34F480; Thu, 18 Dec 2025 15:37:24 +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=1766072245; cv=none; b=KjDnw3yh0U2kN3abDXHafjKhv9HgR+8PXaa3Vwe7+TVk/zcd2J0gxDeJEsA+yVhCzL2jfxEzkL0OD0eGajBbfdIDC8YTOBirK/NHKX5nrBUIS6r/6kCt/2lU0/G1CFnx/mhTVyu+sHoZXSJvihr/IifAQJgRPcR5Od3Z1zcJ8r4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766072245; c=relaxed/simple; bh=M5TuPLyAwIQ91mQDDGCWXB9OR3GiCuPErHP1m44ElZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DAPehThDxWriNqOIwhfGSe3DrRrOFcCYz3Gm/5ApYt8Hlc7hU+xv95qCnd1d9jhXxKuJx/Ajv5rl5N23uxPxA/R0QRSGonH4hHarSaEf9Uys+AUv2az00PpcxpAY759BnDit3gHoI+kSmo/GuwDVoLubZX1L/LOOjFJ1mRzB22E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vQCBCB8U; 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="vQCBCB8U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C25F2C19422; Thu, 18 Dec 2025 15:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766072244; bh=M5TuPLyAwIQ91mQDDGCWXB9OR3GiCuPErHP1m44ElZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vQCBCB8U3lJb9xIbHhKZa8AQzL2K2w74Mj3KdARYjue/rdtnhz4Hldo1qDWnSRSTd VBhejAXQgBlSCu1Dq7rLQHzTm2yNyizR2DNu0WWqznrCJHLirXaJabZmZzzaIQ6QSv H7vjAga+XxydVg5hpS05mYoHCh+tK11H7c5NMXBMBukVwgU19oOwH8ZjJLyvgxLO4T 9GS2SI13BE/c8DopYE84JyMbfuCT5KcKetc4QBAHVGIbb/vee3oZDEYlF9Ra4H5K9Q iEioKWfWZOa//0FsyQY3wcjEwDKrzXB67twSt5W2LsbfUY/gh6Ct+0FLM8PhpQGVJY LozsVmXcHmdaw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWG4B-0000000056I-1QXU; Thu, 18 Dec 2025 16:37:23 +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 v2 5/5] usb: ohci-nxp: clean up probe error labels Date: Thu, 18 Dec 2025 16:35:19 +0100 Message-ID: <20251218153519.19453-6-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251218153519.19453-1-johan@kernel.org> References: <20251218153519.19453-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 Reviewed-by: Vladimir Zapolskiy --- drivers/usb/host/ohci-nxp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index 509ca7d8d513..7663f2aa35e9 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,13 +192,13 @@ static int ohci_hcd_nxp_probe(struct platform_device = *pdev) 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); 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,9 +220,9 @@ 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); -fail_disable: +err_put_client: put_device(&isp1301_i2c_client->dev); isp1301_i2c_client =3D NULL; return ret; --=20 2.51.2