iio: adc: stm32: fix stm32h7_adc_enable error handling
authorFabrice Gasnier <fabrice.gasnier@st.com>
Tue, 23 Jan 2018 16:04:56 +0000 (17:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Feb 2018 09:19:40 +0000 (10:19 +0100)
commitf4f94e9baeba909e2bc5902ed2dd033fa8bb74a3
tree53553b0ee46b051d4153523eb4d83284b297c36c
parent2492eca0a05b05736cbcf7fc1f234a666c4fcc52
iio: adc: stm32: fix stm32h7_adc_enable error handling

commit a3b5655ebdb501a98a45c0d3265dca9f2fe0218a upstream.

Error handling in stm32h7_adc_enable routine doesn't unwind enable
sequence correctly. ADEN can only be cleared by hardware (e.g. by
writing one to ADDIS).
It's also better to clear ADRDY just after it's been set by hardware.

Fixes: 95e339b6e85d ("iio: adc: stm32: add support for STM32H7")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/stm32-adc.c