Skip to contentSkip to conversation

RDMA/hns: Fix missing put_device call in hns_roce_get_cfg

PATCH In review Miaoqian Lin 2 participants 3 messages Jan 10, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/hns: Fix missing put_device call in hns_roce_get_cfg

The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. And hns_roce_find_pdev() calls bus_find_device_by_fwnode(), which calls bus_find_device(). We also need to drop the reference taken by bus_find_device.

Fixes 08805fdbeb2d ("RDMA/hns: Split hw v1 driver from hns roce driver")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +1 -0
index f4af3992ba95..1bffeba55304 100644
@@ -4545,6 +4545,7 @@ static int hns_roce_get_cfg(struct hns_roce_dev *hr_dev)
 				hr_dev->iboe.netdevs[port_cnt] = netdev;
 				hr_dev->iboe.phy_port[port_cnt] = phy_port;
 			} else {
+				put_device(&pdev->dev);
 				dev_err(dev, "no netdev found with pdev %s\n",
 					pdev->name);
 				return -ENODEV;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Miaoqian Lin

The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. And hns_roce_find_pdev() calls bus_find_device_by_fwnode(), which calls bus_find_device(). We also need to drop the reference taken by bus_find_device.

Fixes 08805fdbeb2d ("RDMA/hns: Split hw v1 driver from hns roce driver")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 +
 1 file changed, 1 insertion(+)

This file was removed in the commit 38d220882426 ("RDMA/hns: Remove support for HIP06").

BTW, please recheck your patch submission flow, the received emails have broken "To ..." field that makes reply do not work.

Thanks

#2 lore raw

Hi Leon,

Quoted 7 lines · Leon Romanovsky

This file was removed in the commit 38d220882426 ("RDMA/hns: Remove support for HIP06").

BTW, please recheck your patch submission flow, the received emails have broken "To ..." field that makes reply do not work.

Thanks for reminding me. I'll check it.