OSDN Git Service

iio: adc: cpcap: fix incorrect validation
authorPan Bian <bianpan2016@163.com>
Sun, 12 Nov 2017 16:01:20 +0000 (00:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:52:48 +0000 (09:52 +0100)
commit6f4a0a44ba5aafcb4884b863e0e27923c41ab2ec
tree878d4604a43cfc35ef2fba037b706d80ab624f8d
parentaaeba39ddfe21321c8cfd5e3caeaef1b7153b184
iio: adc: cpcap: fix incorrect validation

commit 81b039ec36a41a5451e1e36f05bb055eceab1dc8 upstream.

Function platform_get_irq_byname() returns a negative error code on
failure, and a zero or positive number on success. However, in function
cpcap_adc_probe(), positive IRQ numbers are also taken as error cases.
Use "if (ddata->irq < 0)" instead of "if (!ddata->irq)" to validate the
return value of platform_get_irq_byname().

Signed-off-by: Pan Bian <bianpan2016@163.com>
Fixes: 25ec249632d50 ("iio: adc: cpcap: Add minimal support for CPCAP PMIC ADC")
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/cpcap-adc.c