Commit 8cf524be authored by Wan Jiabing's avatar Wan Jiabing Committed by Jonathan Cameron

iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc

Fix following coccicheck warning:
./drivers/iio/adc/stm32-adc.c:2014:1-33: WARNING: Function
for_each_available_child_of_node should have of_node_put() before return.

Early exits from for_each_available_child_of_node should decrement the
node reference counter. Replace return by goto here.
Reviewed-by: default avatarFabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: default avatarWan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20211021121826.6339-1-wanjiabing@vivo.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent fb45c7a3
...@@ -2024,7 +2024,8 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev, ...@@ -2024,7 +2024,8 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
if (strlen(name) >= STM32_ADC_CH_SZ) { if (strlen(name) >= STM32_ADC_CH_SZ) {
dev_err(&indio_dev->dev, "Label %s exceeds %d characters\n", dev_err(&indio_dev->dev, "Label %s exceeds %d characters\n",
name, STM32_ADC_CH_SZ); name, STM32_ADC_CH_SZ);
return -EINVAL; ret = -EINVAL;
goto err;
} }
strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ); strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ);
ret = stm32_adc_populate_int_ch(indio_dev, name, val); ret = stm32_adc_populate_int_ch(indio_dev, name, val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment