From: Miaoqian Lin <linmq006@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linmq006@gmail.com, Wenpeng Liang <liangwenpeng@huawei.com>,
Weihang Li <liweihang@huawei.com>, Jason Gunthorpe <jgg@ziepe.ca>,
"Wei Hu(Xavier)" <xavier.huwei@huawei.com>,
Shaobo Xu <xushaobo2@huawei.com>,
Doug Ledford <dledford@redhat.com>, Lijun Ou <oulijun@huawei.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] RDMA/hns: Fix missing put_device call in hns_roce_get_cfg
Date: Mon, 10 Jan 2022 06:12:34 +0000 [thread overview]
Message-ID: <20220110061234.28006-1-linmq006@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2022-01-10 6:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 6:12 Miaoqian Lin [this message]
2022-01-10 7:44 ` [PATCH] RDMA/hns: Fix missing put_device call in hns_roce_get_cfg Leon Romanovsky
2022-01-10 8:23 ` Miaoqian Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220110061234.28006-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=liangwenpeng@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=liweihang@huawei.com \
--cc=oulijun@huawei.com \
--cc=xavier.huwei@huawei.com \
--cc=xushaobo2@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox