Skip to contentSkip to conversation

iio: adc: Fix refcount leak bug in aspeed_adc

PATCH New Liang He 1 participant 1 message Jun 17, 2022

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 iio: adc: Fix refcount leak bug in aspeed_adc

In aspeed_adc_set_trim_data(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.

---
 drivers/iio/adc/aspeed_adc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/adc/aspeed_adc.c +1 -0
index 0793d2474cdc..9341e0e0eb55 100644
@@ -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