From: Qinglang Miao <miaoqinglang@huawei.com>
To: Wu Hao <hao.wu@intel.com>, Tom Rix <trix@redhat.com>,
Moritz Fischer <mdf@kernel.org>
Cc: <linux-fpga@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Qinglang Miao" <miaoqinglang@huawei.com>
Subject: [PATCH] fpga: dfl: add missing platform_device_put in build_info_create_dev
Date: Wed, 25 Nov 2020 14:50:30 +0800 [thread overview]
Message-ID: <20201125065030.154074-1-miaoqinglang@huawei.com> (raw)
platform_device_put is missing when it fails to set fdev->id. Set
a temp value to do sanity check.
Fixes: 543be3d8c999 ("fpga: add device feature list support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
drivers/fpga/dfl.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index b450870b7..8958f0860 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -877,10 +877,13 @@ build_info_create_dev(struct build_feature_devs_info *binfo,
INIT_LIST_HEAD(&binfo->sub_features);
- fdev->id = dfl_id_alloc(type, &fdev->dev);
- if (fdev->id < 0)
- return fdev->id;
+ int tmp_id = dfl_id_alloc(type, &fdev->dev);
+ if (tmp_id < 0) {
+ platform_device_put(fdev);
+ return tmp_id;
+ }
+ fdev->id = tmp_id;
fdev->dev.parent = &binfo->cdev->region->dev;
fdev->dev.devt = dfl_get_devt(dfl_devs[type].devt_type, fdev->id);
--
2.23.0
next reply other threads:[~2020-11-25 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 6:50 Qinglang Miao [this message]
2020-11-25 9:22 ` [PATCH] fpga: dfl: add missing platform_device_put in build_info_create_dev kernel test robot
2020-11-25 10:06 ` Wu, Hao
2020-11-26 1:17 ` Qinglang Miao
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=20201125065030.154074-1-miaoqinglang@huawei.com \
--to=miaoqinglang@huawei.com \
--cc=hao.wu@intel.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=trix@redhat.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;
as well as URLs for NNTP newsgroup(s).