[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220110061234.28006-1-linmq006@gmail.com>
Date: Mon, 10 Jan 2022 06:12:34 +0000
From: Miaoqian Lin <linmq006@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linmq006@...il.com, Wenpeng Liang <liangwenpeng@...wei.com>,
Weihang Li <liweihang@...wei.com>,
Jason Gunthorpe <jgg@...pe.ca>,
"Wei Hu(Xavier)" <xavier.huwei@...wei.com>,
Shaobo Xu <xushaobo2@...wei.com>,
Doug Ledford <dledford@...hat.com>,
Lijun Ou <oulijun@...wei.com>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] 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")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index f4af3992ba95..1bffeba55304 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -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;
--
2.17.1
Powered by blists - more mailing lists