iio: adc: gyroadc: fix leak of device node iterator
authorTobias Jordan <kernel@cdqe.de>
Sat, 26 Sep 2020 16:19:46 +0000 (18:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:43:30 +0000 (11:43 +0100)
commita8c59abdbc6b0c93235f699f4d68740e67d6d646
treef131cc486f26376db7dc65aef2e46ff26140b928
parentad877be5b983a740800e02ec5bb70f4f1ddf4c94
iio: adc: gyroadc: fix leak of device node iterator

commit da4410d4078ba4ead9d6f1027d6db77c5a74ecee upstream.

Add missing of_node_put calls when exiting the for_each_child_of_node
loop in rcar_gyroadc_parse_subdevs early.

Also add goto-exception handling for the error paths in that loop.

Fixes: 059c53b32329 ("iio: adc: Add Renesas GyroADC driver")
Signed-off-by: Tobias Jordan <kernel@cdqe.de>
Link: https://lore.kernel.org/r/20200926161946.GA10240@agrajag.zerfleddert.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/rcar-gyroadc.c