lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241001105717.4566-2-riyandhiman14@gmail.com>
Date: Tue,  1 Oct 2024 16:27:18 +0530
From: Riyan Dhiman <riyandhiman14@...il.com>
To: vigneshr@...com,
	s-vadapalli@...com,
	lpieralisi@...nel.org,
	kw@...ux.com,
	bhelgaas@...gle.com
Cc: kishon@...nel.org,
	linux-omap@...r.kernel.org,
	linux-pci@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	Riyan Dhiman <riyandhiman14@...il.com>
Subject: [PATCH v2] PCI: dra7xx: Added error handling in probe function when devm_phy_get() fails

While creation of device link, if devm_phy_get() function fails then it 
directly returns PTR_ERR without any cleanup of previous added device 
links.

Added goto statement to handle the cleanup of already added device links.

Fixes: 7a4db656a635 (PCI: dra7xx: Create functional dependency between 
PCIe and PHY)
Signed-off-by: Riyan Dhiman <riyandhiman14@...il.com>
---
v2: resend when tree is open and reformat commit message

 drivers/pci/controller/dwc/pci-dra7xx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index 4fe3b0cb72ec..c329d107b811 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -762,8 +762,10 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
 	for (i = 0; i < phy_count; i++) {
 		snprintf(name, sizeof(name), "pcie-phy%d", i);
 		phy[i] = devm_phy_get(dev, name);
-		if (IS_ERR(phy[i]))
-			return PTR_ERR(phy[i]);
+		if (IS_ERR(phy[i])) {
+			ret = PTR_ERR(phy[i]);
+			goto err_link;
+		}
 
 		link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS);
 		if (!link[i]) {
-- 
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ