Skip to content

Commit

Permalink
iio: adc: stmpe-adc: Shuffle an if statement around in stmpe_adc_isr
Browse files Browse the repository at this point in the history
When building with -Wsometimes-uninitialized, Clang warns:

drivers/iio/adc/stmpe-adc.c:204:13: warning: variable 'data' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Clang can't tell that data will never be used uninitialized because the
two if statements take care of all cases. Remove the first if statement
and make it the else branch of the second one so that it is apparent to
Clang that all cases are covered.

Link: ClangBuiltLinux#387
Suggested-by: Nick Desaulniers <[email protected]>
Signed-off-by: Nathan Chancellor <[email protected]>
Reviewed-by: NIck Desaulniers <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
nathanchance authored and jic23 committed Apr 4, 2019
1 parent 6f9ca1d commit 17104ca
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/iio/adc/stmpe-adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
struct stmpe_adc *info = (struct stmpe_adc *)dev_id;
u16 data;

if (info->channel > STMPE_TEMP_CHANNEL)
return IRQ_NONE;

if (info->channel <= STMPE_ADC_LAST_NR) {
int int_sta;

Expand All @@ -205,6 +202,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
/* Read value */
stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
(u8 *) &data);
} else {
return IRQ_NONE;
}

info->value = (u32) be16_to_cpu(data);
Expand Down

0 comments on commit 17104ca

Please sign in to comment.