Commit c2ab4474 authored by Anders Darander's avatar Anders Darander Committed by Jonathan Cameron

iio: adc: at91: unbreak channel adc channel 3

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 84882b06 ("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: default avatarAnders Darander <anders@chargestorm.se>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent ddbc719f
...@@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private) ...@@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
st->ts_bufferedmeasure = false; st->ts_bufferedmeasure = false;
input_report_key(st->ts_input, BTN_TOUCH, 0); input_report_key(st->ts_input, BTN_TOUCH, 0);
input_sync(st->ts_input); input_sync(st->ts_input);
} else if (status & AT91_ADC_EOC(3)) { } else if (status & AT91_ADC_EOC(3) && st->ts_input) {
/* Conversion finished */ /* Conversion finished and we've a touchscreen */
if (st->ts_bufferedmeasure) { if (st->ts_bufferedmeasure) {
/* /*
* Last measurement is always discarded, since it can * Last measurement is always discarded, since it can
......
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