Skip to content

Commit

Permalink
iio: adc: berlin2-adc: Add missing of_node_put() in error path
Browse files Browse the repository at this point in the history
commit cbd3a01 upstream.

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: 70f1937 ("iio: adc: add support for Berlin")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Link: https://lore.kernel.org/r/20221129020316.191731-1-wangxiongfeng2@huawei.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
fenghusthu authored and gregkh committed Feb 9, 2023
1 parent 0b2f949 commit 9e48021
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iio/adc/berlin2-adc.c
Expand Up @@ -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);

Expand Down

0 comments on commit 9e48021

Please sign in to comment.