Skip to contentSkip to conversation

phy: HiSilicon: Fix copy and paste bug in error handling

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 17, 2021 – Nov 23, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: HiSilicon: Fix copy and paste bug in error handling

This should check ">pmctrl" instead of "->sysctrl". This bug could potentially lead to a crash if we dereference the error pointer.

Fixes 73075011ffff ("phy: HiSilicon: Add driver for Kirin 970 PCIe PHY")
---
 drivers/phy/hisilicon/phy-hi3670-pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/hisilicon/phy-hi3670-pcie.c +2 -2
index c64c6679b1b9..0ac9634b398d 100644
@@ -757,8 +757,8 @@ static int hi3670_pcie_phy_get_resources(struct hi3670_pcie_phy *phy,
 		return PTR_ERR(phy->sysctrl);
 
 	phy->pmctrl = syscon_regmap_lookup_by_compatible("hisilicon,hi3670-pmctrl");
-	if (IS_ERR(phy->sysctrl))
-		return PTR_ERR(phy->sysctrl);
+	if (IS_ERR(phy->pmctrl))
+		return PTR_ERR(phy->pmctrl);
 
 	/* clocks */
 	phy->phy_ref_clk = devm_clk_get(dev, "phy_ref");
Signature · 7 lines
2.20.1


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
Reviewed-by on v1 1/1
#1 lore raw

Em Wed, 17 Nov 2021 10:48:43 +0300
Dan Carpenter <[email protected]> escreveu:

Quoted 5 lines

This should check ">pmctrl" instead of "->sysctrl". This bug could potentially lead to a crash if we dereference the error pointer.

Fixes 73075011ffff ("phy: HiSilicon: Add driver for Kirin 970 PCIe PHY")
Quoted 19 lines
---
 drivers/phy/hisilicon/phy-hi3670-pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/hisilicon/phy-hi3670-pcie.c +2 -2
index c64c6679b1b9..0ac9634b398d 100644
@@ -757,8 +757,8 @@ static int hi3670_pcie_phy_get_resources(struct hi3670_pcie_phy *phy,
 		return PTR_ERR(phy->sysctrl);
 
 	phy->pmctrl = syscon_regmap_lookup_by_compatible("hisilicon,hi3670-pmctrl");
-	if (IS_ERR(phy->sysctrl))
-		return PTR_ERR(phy->sysctrl);
+	if (IS_ERR(phy->pmctrl))
+		return PTR_ERR(phy->pmctrl);
 
 	/* clocks */
 	phy->phy_ref_clk = devm_clk_get(dev, "phy_ref");
maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

This should check ">pmctrl" instead of "->sysctrl". This bug could potentially lead to a crash if we dereference the error pointer.

Applied, thanks

Signature · 1 line
~Vinod