* [PATCH v2] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc
@ 2021-10-21 12:18 ` Wan Jiabing
0 siblings, 0 replies; 4+ messages in thread
From: Wan Jiabing @ 2021-10-21 12:18 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Maxime Coquelin,
Alexandre Torgue, Fabrice Gasnier, Olivier Moysan,
Mauro Carvalho Chehab, Xu Wang, Ahmad Fatoum, Wan Jiabing,
linux-iio, linux-stm32, linux-arm-kernel, linux-kernel
Cc: kael_w
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. Repalce return by goto here.
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
Changelog:
v2:
- Fix typo and add reviewed-by.
---
drivers/iio/adc/stm32-adc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 6245434f8377..7f1fb36c747c 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -2024,7 +2024,8 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
if (strlen(name) >= STM32_ADC_CH_SZ) {
dev_err(&indio_dev->dev, "Label %s exceeds %d characters\n",
name, STM32_ADC_CH_SZ);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err;
}
strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ);
ret = stm32_adc_populate_int_ch(indio_dev, name, val);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc
@ 2021-10-21 12:18 ` Wan Jiabing
0 siblings, 0 replies; 4+ messages in thread
From: Wan Jiabing @ 2021-10-21 12:18 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Maxime Coquelin,
Alexandre Torgue, Fabrice Gasnier, Olivier Moysan,
Mauro Carvalho Chehab, Xu Wang, Ahmad Fatoum, Wan Jiabing,
linux-iio, linux-stm32, linux-arm-kernel, linux-kernel
Cc: kael_w
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. Repalce return by goto here.
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
Changelog:
v2:
- Fix typo and add reviewed-by.
---
drivers/iio/adc/stm32-adc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 6245434f8377..7f1fb36c747c 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -2024,7 +2024,8 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
if (strlen(name) >= STM32_ADC_CH_SZ) {
dev_err(&indio_dev->dev, "Label %s exceeds %d characters\n",
name, STM32_ADC_CH_SZ);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err;
}
strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ);
ret = stm32_adc_populate_int_ch(indio_dev, name, val);
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc
2021-10-21 12:18 ` Wan Jiabing
@ 2021-10-28 14:26 ` Jonathan Cameron
-1 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2021-10-28 14:26 UTC (permalink / raw)
To: Wan Jiabing
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue,
Fabrice Gasnier, Olivier Moysan, Mauro Carvalho Chehab, Xu Wang,
Ahmad Fatoum, linux-iio, linux-stm32, linux-arm-kernel,
linux-kernel, kael_w
On Thu, 21 Oct 2021 08:18:23 -0400
Wan Jiabing <wanjiabing@vivo.com> wrote:
> 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. Repalce return by goto here.
Replace
>
> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
We could treat this as a fix, but I'm feeling lazy and it's a minor that
should be harmless. So applied to the togreg branch of iio.git and pushed
out as testing for 0-day to see if it can find anything we missed.
Thanks,
Jonathan
> ---
> Changelog:
> v2:
> - Fix typo and add reviewed-by.
> ---
> drivers/iio/adc/stm32-adc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> index 6245434f8377..7f1fb36c747c 100644
> --- a/drivers/iio/adc/stm32-adc.c
> +++ b/drivers/iio/adc/stm32-adc.c
> @@ -2024,7 +2024,8 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
> if (strlen(name) >= STM32_ADC_CH_SZ) {
> dev_err(&indio_dev->dev, "Label %s exceeds %d characters\n",
> name, STM32_ADC_CH_SZ);
> - return -EINVAL;
> + ret = -EINVAL;
> + goto err;
> }
> strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ);
> ret = stm32_adc_populate_int_ch(indio_dev, name, val);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc
@ 2021-10-28 14:26 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2021-10-28 14:26 UTC (permalink / raw)
To: Wan Jiabing
Cc: Lars-Peter Clausen, Maxime Coquelin, Alexandre Torgue,
Fabrice Gasnier, Olivier Moysan, Mauro Carvalho Chehab, Xu Wang,
Ahmad Fatoum, linux-iio, linux-stm32, linux-arm-kernel,
linux-kernel, kael_w
On Thu, 21 Oct 2021 08:18:23 -0400
Wan Jiabing <wanjiabing@vivo.com> wrote:
> 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. Repalce return by goto here.
Replace
>
> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
We could treat this as a fix, but I'm feeling lazy and it's a minor that
should be harmless. So applied to the togreg branch of iio.git and pushed
out as testing for 0-day to see if it can find anything we missed.
Thanks,
Jonathan
> ---
> Changelog:
> v2:
> - Fix typo and add reviewed-by.
> ---
> drivers/iio/adc/stm32-adc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> index 6245434f8377..7f1fb36c747c 100644
> --- a/drivers/iio/adc/stm32-adc.c
> +++ b/drivers/iio/adc/stm32-adc.c
> @@ -2024,7 +2024,8 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
> if (strlen(name) >= STM32_ADC_CH_SZ) {
> dev_err(&indio_dev->dev, "Label %s exceeds %d characters\n",
> name, STM32_ADC_CH_SZ);
> - return -EINVAL;
> + ret = -EINVAL;
> + goto err;
> }
> strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ);
> ret = stm32_adc_populate_int_ch(indio_dev, name, val);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-28 14:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 12:18 [PATCH v2] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc Wan Jiabing
2021-10-21 12:18 ` Wan Jiabing
2021-10-28 14:26 ` Jonathan Cameron
2021-10-28 14:26 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.