[PATCH v2 1/1] PCI: microchip: add return value check to devm_add_action_or_reset()

Yuanjun Gong ruc_gongyuanjun at 163.com
Mon Jul 17 07:44:51 PDT 2023


devm_add_action_or_reset() may fail, therefore, a check to the
return value of devm_add_action_or_reset() is added before return.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun at 163.com>
---
 drivers/pci/controller/pcie-microchip-host.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
index 5e710e485464..dd0215dbda77 100644
--- a/drivers/pci/controller/pcie-microchip-host.c
+++ b/drivers/pci/controller/pcie-microchip-host.c
@@ -863,8 +863,9 @@ static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
 	if (ret)
 		return ERR_PTR(ret);
 
-	devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
-				 clk);
+	ret = devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare, clk);
+	if (ret)
+		return ERR_PTR(ret);
 
 	return clk;
 }
-- 
2.17.1




More information about the linux-riscv mailing list