Skip to content

Commit 41ac424

Browse files
jim2101024bjorn-helgaas
authored andcommitted
PCI: brcmstb: Fix function return value handling
Do at least a dev_err() on some calls to reset_control_rearm() and brcm_phy_stop(). In some cases it may not make sense to return this error value "above" as doing so will cause more trouble than is warranted. Link: https://lore.kernel.org/r/20220106160332.2143-2-jim2101024@gmail.com Signed-off-by: Jim Quinlan <jim2101024@gmail.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
1 parent 09a710d commit 41ac424

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,11 +1155,23 @@ static int brcm_pcie_suspend(struct device *dev)
11551155
int ret;
11561156

11571157
brcm_pcie_turn_off(pcie);
1158-
ret = brcm_phy_stop(pcie);
1159-
reset_control_rearm(pcie->rescal);
1158+
/*
1159+
* If brcm_phy_stop() returns an error, just dev_err(). If we
1160+
* return the error it will cause the suspend to fail and this is a
1161+
* forgivable offense that will probably be erased on resume.
1162+
*/
1163+
if (brcm_phy_stop(pcie))
1164+
dev_err(dev, "Could not stop phy for suspend\n");
1165+
1166+
ret = reset_control_rearm(pcie->rescal);
1167+
if (ret) {
1168+
dev_err(dev, "Could not rearm rescal reset\n");
1169+
return ret;
1170+
}
1171+
11601172
clk_disable_unprepare(pcie->clk);
11611173

1162-
return ret;
1174+
return 0;
11631175
}
11641176

11651177
static int brcm_pcie_resume(struct device *dev)
@@ -1170,7 +1182,9 @@ static int brcm_pcie_resume(struct device *dev)
11701182
int ret;
11711183

11721184
base = pcie->base;
1173-
clk_prepare_enable(pcie->clk);
1185+
ret = clk_prepare_enable(pcie->clk);
1186+
if (ret)
1187+
return ret;
11741188

11751189
ret = reset_control_reset(pcie->rescal);
11761190
if (ret)
@@ -1211,8 +1225,10 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie)
12111225
{
12121226
brcm_msi_remove(pcie);
12131227
brcm_pcie_turn_off(pcie);
1214-
brcm_phy_stop(pcie);
1215-
reset_control_rearm(pcie->rescal);
1228+
if (brcm_phy_stop(pcie))
1229+
dev_err(pcie->dev, "Could not stop phy\n");
1230+
if (reset_control_rearm(pcie->rescal))
1231+
dev_err(pcie->dev, "Could not rearm rescal reset\n");
12161232
clk_disable_unprepare(pcie->clk);
12171233
}
12181234

0 commit comments

Comments
 (0)