Skip to content

Commit cbd3a01

Browse files
fenghusthujic23
authored andcommitted
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: 70f1937 ("iio: adc: add support for Berlin") Signed-off-by: Xiongfeng Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent cc33040 commit cbd3a01

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/iio/adc/berlin2-adc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,10 @@ static int berlin2_adc_probe(struct platform_device *pdev)
298298
int ret;
299299

300300
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
301-
if (!indio_dev)
301+
if (!indio_dev) {
302+
of_node_put(parent_np);
302303
return -ENOMEM;
304+
}
303305

304306
priv = iio_priv(indio_dev);
305307

0 commit comments

Comments
 (0)