Skip to content

Commit b36fb50

Browse files
tititiou36kwilczynski
authored andcommitted
PCI: histb: Fix an error handling path in histb_pcie_probe()
If an error occurs after a successful phy_init() call, then phy_exit() should be called. Add the missing call, as already done in the remove function. Fixes: bbd11bd ("PCI: hisi: Add HiSilicon STB SoC PCIe controller driver") Signed-off-by: Christophe JAILLET <[email protected]> [kwilczynski: remove unnecessary hipcie->phy NULL check from histb_pcie_probe() and squash a patch that removes similar NULL check for hipcie-phy from histb_pcie_remove() from https://lore.kernel.org/linux-pci/c369b5d25e17a44984ae5a889ccc28a59a0737f7.1742058005.git.christophe.jaillet@wanadoo.fr] Signed-off-by: Krzysztof Wilczyński <[email protected]> Link: https://lore.kernel.org/r/8301fc15cdea5d2dac21f57613e8e6922fb1ad95.1740854531.git.christophe.jaillet@wanadoo.fr
1 parent 2014c95 commit b36fb50

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/pci/controller/dwc/pcie-histb.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,21 @@ static int histb_pcie_probe(struct platform_device *pdev)
409409
ret = histb_pcie_host_enable(pp);
410410
if (ret) {
411411
dev_err(dev, "failed to enable host\n");
412-
return ret;
412+
goto err_exit_phy;
413413
}
414414

415415
ret = dw_pcie_host_init(pp);
416416
if (ret) {
417417
dev_err(dev, "failed to initialize host\n");
418-
return ret;
418+
goto err_exit_phy;
419419
}
420420

421421
return 0;
422+
423+
err_exit_phy:
424+
phy_exit(hipcie->phy);
425+
426+
return ret;
422427
}
423428

424429
static void histb_pcie_remove(struct platform_device *pdev)
@@ -427,8 +432,7 @@ static void histb_pcie_remove(struct platform_device *pdev)
427432

428433
histb_pcie_host_disable(hipcie);
429434

430-
if (hipcie->phy)
431-
phy_exit(hipcie->phy);
435+
phy_exit(hipcie->phy);
432436
}
433437

434438
static const struct of_device_id histb_pcie_of_match[] = {

0 commit comments

Comments
 (0)