diff mbox series

[1/1] pci: add a return value check

Message ID 20230716124740.4777-1-ruc_gongyuanjun@163.com (mailing list archive)
State New, archived
Delegated to: Krzysztof WilczyƄski
Headers show
Series [1/1] pci: add a return value check | expand

Commit Message

Yuanjun Gong July 16, 2023, 12:47 p.m. UTC
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@163.com>
---
 drivers/pci/controller/dwc/pci-meson.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
index c1527693bed9..8b8a2df4ee62 100644
--- a/drivers/pci/controller/dwc/pci-meson.c
+++ b/drivers/pci/controller/dwc/pci-meson.c
@@ -187,9 +187,11 @@  static inline struct clk *meson_pcie_probe_clock(struct device *dev,
 		return ERR_PTR(ret);
 	}
 
-	devm_add_action_or_reset(dev,
+	ret = devm_add_action_or_reset(dev,
 				 (void (*) (void *))clk_disable_unprepare,
 				 clk);
+	if (ret)
+		return ERR_PTR(ret);
 
 	return clk;
 }