iio: adc: aspeed: Fix refcount leak in aspeed_adc_set_trim_data
Subsystems (2)
PATCH 1/1 iio: adc: aspeed: Fix refcount leak in aspeed_adc_set_trim_data
of_find_node_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.
Fixes d0a4c17b4073 ("iio: adc: aspeed: Get and set trimming data.")
Signed-off-by Miaoqian Lin <[email protected]>
--- drivers/iio/adc/aspeed_adc.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/aspeed_adc.c +1 -0
@@ -186,6 +186,7 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)return -EOPNOTSUPP ; } scu =syscon_node_to_regmap (syscon); +of_node_put (syscon);if (IS_ERR (scu)) {dev_warn (data->dev,"Failed to get syscon regmap\n" );return -EOPNOTSUPP ;
Signature · 1 line
2.25.1
Jonathan Cameron
maintainerQuoted 6 lines · On Mon, 16 May 2022 11:52:02 +0400 Miaoqian Lin <[email protected]> wrote:
of_find_node_by_name()returns a node pointer with refcount incremented, we should useof_node_put()on it when done. Add missingof_node_put()to avoid refcount leak.Fixes d0a4c17b4073 ("iio: adc: aspeed: Get and set trimming data.")Signed-off-by Miaoqian Lin <[email protected]>
In the 'hopefully obviously correct' category so applied to the fixes togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
Quoted 16 lines
--- drivers/iio/adc/aspeed_adc.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/adc/aspeed_adc.c +1
-0@@ -186,6 +186,7 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)return -EOPNOTSUPP ; } scu =syscon_node_to_regmap (syscon); +of_node_put (syscon);if (IS_ERR (scu)) {dev_warn (data->dev,"Failed to get syscon regmap\n" );return -EOPNOTSUPP ;