diff mbox series

iio: adc: Fix error handling in vadc_do_conversion

Message ID 20210301081622.15696-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New
Headers show
Series iio: adc: Fix error handling in vadc_do_conversion | expand

Commit Message

Dinghao Liu March 1, 2021, 8:16 a.m. UTC
There is one vadc_poll_wait_eoc() call in vadc_do_conversion
that we have caught its return value but lack further handling.
Check and jump to err_disable label just like the other
vadc_poll_wait_eoc() in this function.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jonathan Cameron March 6, 2021, 5:18 p.m. UTC | #1
On Mon,  1 Mar 2021 16:16:22 +0800
Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:

> There is one vadc_poll_wait_eoc() call in vadc_do_conversion
> that we have caught its return value but lack further handling.
> Check and jump to err_disable label just like the other
> vadc_poll_wait_eoc() in this function.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Looks good to me, but will leave this a little longer for others to review.
If it looks like I have forgotten it in 2 weeks time, feel free to remind
me!

Jonathan

> ---
>  drivers/iio/adc/qcom-spmi-vadc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> index 05ff948372b3..fe36b0ba8273 100644
> --- a/drivers/iio/adc/qcom-spmi-vadc.c
> +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> @@ -324,6 +324,8 @@ static int vadc_do_conversion(struct vadc_priv *vadc,
>  
>  	if (vadc->poll_eoc) {
>  		ret = vadc_poll_wait_eoc(vadc, timeout);
> +		if (ret)
> +			goto err_disable;
>  	} else {
>  		ret = wait_for_completion_timeout(&vadc->complete, timeout);
>  		if (!ret) {
diff mbox series

Patch

diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index 05ff948372b3..fe36b0ba8273 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -324,6 +324,8 @@  static int vadc_do_conversion(struct vadc_priv *vadc,
 
 	if (vadc->poll_eoc) {
 		ret = vadc_poll_wait_eoc(vadc, timeout);
+		if (ret)
+			goto err_disable;
 	} else {
 		ret = wait_for_completion_timeout(&vadc->complete, timeout);
 		if (!ret) {