Commit cbd3a015 authored by Xiongfeng Wang's avatar Xiongfeng Wang Committed by Jonathan Cameron
Browse files

iio: adc: berlin2-adc: Add missing of_node_put() in error path



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: 70f19379 ("iio: adc: add support for Berlin")
Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Link: https://lore.kernel.org/r/20221129020316.191731-1-wangxiongfeng2@huawei.com


Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent cc330405
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -298,8 +298,10 @@ static int berlin2_adc_probe(struct platform_device *pdev)
	int ret;
	int ret;


	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
	if (!indio_dev)
	if (!indio_dev) {
		of_node_put(parent_np);
		return -ENOMEM;
		return -ENOMEM;
	}


	priv = iio_priv(indio_dev);
	priv = iio_priv(indio_dev);