Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 70f1937911ca ("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>

authored by

Xiongfeng Wang and committed by
Jonathan Cameron
cbd3a015 cc330405

+3 -1
+3 -1
drivers/iio/adc/berlin2-adc.c
··· 298 298 int ret; 299 299 300 300 indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); 301 - if (!indio_dev) 301 + if (!indio_dev) { 302 + of_node_put(parent_np); 302 303 return -ENOMEM; 304 + } 303 305 304 306 priv = iio_priv(indio_dev); 305 307