From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7AC6631A046 for ; Fri, 5 Jun 2026 13:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780667616; cv=none; b=bnfzeR6YjNDxtXmLBR4OwCpbmkVSXW4NVpdyLAYkXrQzt3LUoCzw2t/zxh9YzzBR+tLyWqKsG8eq0UIQ5YkjNKp962HY52b6RiHqEaHZLMPqQ0vLxkEJE2TGP4920X8oe3Gv6bAjGg0pxaf4GtZErrfUjbWAPPgDIa1UniMZBH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780667616; c=relaxed/simple; bh=jcoGz8k6RMuNLFKToW7rrjX5v7nM+ixo2VzY62yiezY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AbvpJxKPcb5YnVTfEm6+H3wWsGomnLqFCHn01tn9pGavX4NAXz/R+O2nQ0krJ+skqYZUWksX8witguwnIyMQISuqi0IWBD0JS4pXh/0FJIEd52Qg/YeZO93uTc10kthrcP/3I0jHCWZQldCzvbC7tBQ/brCqqztFI0mTurW7vbM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mmz4Zget; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mmz4Zget" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DFEB1F00893; Fri, 5 Jun 2026 13:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780667615; bh=pjXBeeD01QKQ23ld1D9XyoVPW1k/Ks2fMhmlNThA+Q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mmz4ZgetZZWZtg6KegTJZkrQGPbh/tQGtqhCnCK7N+g1JfxlwqlxCfg2DvRvAUOSC gU26FOxF2gcZYvIC1lBpMfiYtymHh0zUPGfVY77QWKTCbhskBuonUN0J60iYeBuC1e 6Az0xciQOoTSgqtq/WLwYglrsO0Azk0K9tKsQQbhU9V5JnHi1pkncitoDAQHn4467g /4aPg3xjPfgv2nUGq7YEG8LsONDIDCpFrHDF2ivB3IIJTJ51fjxgowcawlPeJKx/ki KcVcw8hgC6gedVfz7dUOpKbYw5itmY+lAnCMEriCwGJ4FtP+2wLyRY/Ew5ksQz8pDp ddcsjYVSTYVbg== From: Sasha Levin To: stable@vger.kernel.org Cc: Radhey Shyam Pandey , Thinh Nguyen , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 6.12.y] usb: dwc3: xilinx: fix error handling in zynqmp init error paths Date: Fri, 5 Jun 2026 09:53:32 -0400 Message-ID: <20260605135332.930021-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026060415-seismic-transpose-4d27@gregkh> References: <2026060415-seismic-transpose-4d27@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Radhey Shyam Pandey [ Upstream commit c1a0ecbf32c4b397353204e2ec94c5bb9f3300ed ] Fix error handling and resource cleanup i.e remove invalid phy_exit() after failed phy_init(), route failures through proper cleanup paths and return 0 explicitly on success. Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms") Cc: stable@vger.kernel.org Acked-by: Thinh Nguyen Signed-off-by: Radhey Shyam Pandey Link: https://patch.msgid.link/20260519115529.2980421-1-radhey.shyam.pandey@amd.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/dwc3-xilinx.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c index 47e891c9233770..939783e4a98b00 100644 --- a/drivers/usb/dwc3/dwc3-xilinx.c +++ b/drivers/usb/dwc3/dwc3-xilinx.c @@ -170,15 +170,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) } ret = phy_init(priv_data->usb3_phy); - if (ret < 0) { - phy_exit(priv_data->usb3_phy); + if (ret < 0) goto err; - } ret = reset_control_deassert(apbrst); if (ret < 0) { dev_err(dev, "Failed to release APB reset\n"); - goto err; + goto err_phy_exit; } /* Set PIPE Power Present signal in FPD Power Present Register*/ @@ -190,27 +188,25 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) ret = reset_control_deassert(crst); if (ret < 0) { dev_err(dev, "Failed to release core reset\n"); - goto err; + goto err_phy_exit; } ret = reset_control_deassert(hibrst); if (ret < 0) { dev_err(dev, "Failed to release hibernation reset\n"); - goto err; + goto err_phy_exit; } ret = phy_power_on(priv_data->usb3_phy); - if (ret < 0) { - phy_exit(priv_data->usb3_phy); - goto err; - } + if (ret < 0) + goto err_phy_exit; skip_usb3_phy: /* ulpi reset via gpio-modepin or gpio-framework driver */ reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(reset_gpio)) { - return dev_err_probe(dev, PTR_ERR(reset_gpio), - "Failed to request reset GPIO\n"); + ret = PTR_ERR(reset_gpio); + goto err_phy_power_off; } if (reset_gpio) { @@ -230,6 +226,12 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) writel(reg, priv_data->regs + XLNX_USB_TRAFFIC_ROUTE_CONFIG); } + return 0; + +err_phy_power_off: + phy_power_off(priv_data->usb3_phy); +err_phy_exit: + phy_exit(priv_data->usb3_phy); err: return ret; } -- 2.53.0