Skip to content

Commit

Permalink
iio: adc: at91: unbreak channel adc channel 3
Browse files Browse the repository at this point in the history
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 84882b0 ("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>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Anders Darander authored and Jonathan Cameron committed Aug 15, 2016
1 parent ddbc719 commit c2ab447
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/iio/adc/at91_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
st->ts_bufferedmeasure = false;
input_report_key(st->ts_input, BTN_TOUCH, 0);
input_sync(st->ts_input);
} else if (status & AT91_ADC_EOC(3)) {
/* Conversion finished */
} else if (status & AT91_ADC_EOC(3) && st->ts_input) {
/* Conversion finished and we've a touchscreen */
if (st->ts_bufferedmeasure) {
/*
* Last measurement is always discarded, since it can
Expand Down

0 comments on commit c2ab447

Please sign in to comment.