From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
To: <jic23@kernel.org>, <lars@metafoo.de>
Cc: <linux-iio@vger.kernel.org>, <wangxiongfeng2@huawei.com>,
<yangyingliang@huawei.com>, <guohanjun@huawei.com>,
<jonathan.cameron@huawei.com>
Subject: [PATCH] iio: adc: berlin2-adc: Add missing of_node_put() in error path
Date: Tue, 29 Nov 2022 10:03:16 +0800 [thread overview]
Message-ID: <20221129020316.191731-1-wangxiongfeng2@huawei.com> (raw)
of_get_parent() will return a device_node pointer with refcount
incremented. We need to use of_node_put() on it when done. Add the
missing of_node_put() in the error path of berlin2_adc_probe();
Fixes: 70f1937911ca ("iio: adc: add support for Berlin")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
drivers/iio/adc/berlin2-adc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c
index 3d2e8b4db61a..a4e7c7eff5ac 100644
--- a/drivers/iio/adc/berlin2-adc.c
+++ b/drivers/iio/adc/berlin2-adc.c
@@ -298,8 +298,10 @@ static int berlin2_adc_probe(struct platform_device *pdev)
int ret;
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
- if (!indio_dev)
+ if (!indio_dev) {
+ of_node_put(parent_np);
return -ENOMEM;
+ }
priv = iio_priv(indio_dev);
--
2.20.1
next reply other threads:[~2022-11-29 1:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 2:03 Xiongfeng Wang [this message]
2022-12-04 14:27 ` [PATCH] iio: adc: berlin2-adc: Add missing of_node_put() in error path Jonathan Cameron
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=20221129020316.191731-1-wangxiongfeng2@huawei.com \
--to=wangxiongfeng2@huawei.com \
--cc=guohanjun@huawei.com \
--cc=jic23@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=yangyingliang@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