iio: stmpe-adc: avoid harmless clang warning
PATCH 1/1 iio: stmpe-adc: avoid harmless clang warning
Clang points out a control flow bug, which happens to be harmless:
drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
The warning is sensible here, so let's just avoid the case by adding appropriate error handling.
--- drivers/iio/adc/stmpe-adc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/stmpe-adc.c +2 -0
@@ -205,6 +205,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);
Signature · 7 lines
2.20.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 28 lines · Arnd Bergmann
Clang points out a control flow bug, which happens to be harmless:
drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]The warning is sensible here, so let's just avoid the case by adding appropriate error handling.
Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iio/adc/stmpe-adc.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/adc/stmpe-adc.c +2
-0@@ -205,6 +205,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);Signature · 1 line
2.20.0
I sent a similar patch, which is sitting in Jonathan's testing branch:
Nathan
Quoted 26 lines · Nathan Chancellor
Quoted 24 lines · Arnd Bergmann
Clang points out a control flow bug, which happens to be harmless:
drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]The warning is sensible here, so let's just avoid the case by adding appropriate error handling.
Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iio/adc/stmpe-adc.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/adc/stmpe-adc.c +2
-0@@ -205,6 +205,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 ; }
Quoted 8 lines
Quoted 4 lines
drivers/iio/adc/stmpe-adc.c +0
-1info->value = (u32 )be16_to_cpu (data); --2.20.0
I sent a similar patch, which is sitting in Jonathan's testing branch:
Ok, sorry for the dup. Your seems to be better than mine, too.
Arnd