iio: adc: at91: unbreak channel adc channel 3
authorAnders Darander <anders@chargestorm.se>
Mon, 8 Aug 2016 12:42:16 +0000 (14:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Sep 2016 08:07:38 +0000 (10:07 +0200)
commit8f1f9b0ffd8ae8310c5ec80e6e9d6f508946da10
treed003a992d938cd803bd43484c058c510c8fe0f6a
parent734ee23cd4c134ed046812c82302fe05543b3b92
iio: adc: at91: unbreak channel adc channel 3

commit c2ab447454d498e709d9011c0f2d2945ee321f9b upstream.

The driver always assumes that an input device has been created when
reading channel 3. This causes a kernel panic when dereferencing
st->ts_input.

The change was introduced in
commit 84882b060301 ("iio: adc: at91_adc: Add support for touchscreens
without TSMR"). Earlier versions only entered that part of the if-else
statement if only the following flags are set:

AT91_ADC_IER_XRDY | AT91_ADC_IER_YRDY | AT91_ADC_IER_PRDY

Signed-off-by: Anders Darander <anders@chargestorm.se>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/at91_adc.c