[PATCH] pcie-designware: Fix dev_get_resource_by_name error check

Sascha Hauer s.hauer at pengutronix.de
Wed May 3 05:27:08 PDT 2023


dev_get_resource_by_name() returns an error pointer, fix the check
accordingly.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/pci/pcie-designware-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pcie-designware-host.c b/drivers/pci/pcie-designware-host.c
index c143de4eef..b34fc482ed 100644
--- a/drivers/pci/pcie-designware-host.c
+++ b/drivers/pci/pcie-designware-host.c
@@ -87,7 +87,7 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
 	ns = of_n_size_cells(np);
 
 	cfg_res = dev_get_resource_by_name(dev, IORESOURCE_MEM, "config");
-	if (cfg_res) {
+	if (!IS_ERR(cfg_res)) {
 		pp->cfg0_size = resource_size(cfg_res) >> 1;
 		pp->cfg1_size = resource_size(cfg_res) >> 1;
 		pp->cfg0_base = cfg_res->start;
-- 
2.39.2




More information about the barebox mailing list