* [PATCH] iio: adc: berlin2-adc: Add missing of_node_put() in error path
@ 2022-11-29 2:03 Xiongfeng Wang
2022-12-04 14:27 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Xiongfeng Wang @ 2022-11-29 2:03 UTC (permalink / raw)
To: jic23, lars
Cc: linux-iio, wangxiongfeng2, yangyingliang, guohanjun,
jonathan.cameron
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] iio: adc: berlin2-adc: Add missing of_node_put() in error path
2022-11-29 2:03 [PATCH] iio: adc: berlin2-adc: Add missing of_node_put() in error path Xiongfeng Wang
@ 2022-12-04 14:27 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-12-04 14:27 UTC (permalink / raw)
To: Xiongfeng Wang
Cc: lars, linux-iio, yangyingliang, guohanjun, jonathan.cameron
On Tue, 29 Nov 2022 10:03:16 +0800
Xiongfeng Wang <wangxiongfeng2@huawei.com> wrote:
> 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>
Applied.
Thanks,
Jonathan
> ---
> 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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-04 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-29 2:03 [PATCH] iio: adc: berlin2-adc: Add missing of_node_put() in error path Xiongfeng Wang
2022-12-04 14:27 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox