diff options
author | Pan Bian <bianpan2016@163.com> | 2017-11-12 11:01:20 -0500 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2017-12-02 06:15:13 -0500 |
commit | 81b039ec36a41a5451e1e36f05bb055eceab1dc8 (patch) | |
tree | 37244f40cbd7b4ed0874b772118586e5fdcb7027 | |
parent | 0590cdfead8cd6319cc58b5dbe8ab9fbaabae131 (diff) |
iio: adc: cpcap: fix incorrect validation
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>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/adc/cpcap-adc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/cpcap-adc.c b/drivers/iio/adc/cpcap-adc.c index 3576ec73ec23..9ad60421d360 100644 --- a/drivers/iio/adc/cpcap-adc.c +++ b/drivers/iio/adc/cpcap-adc.c | |||
@@ -1011,7 +1011,7 @@ static int cpcap_adc_probe(struct platform_device *pdev) | |||
1011 | platform_set_drvdata(pdev, indio_dev); | 1011 | platform_set_drvdata(pdev, indio_dev); |
1012 | 1012 | ||
1013 | ddata->irq = platform_get_irq_byname(pdev, "adcdone"); | 1013 | ddata->irq = platform_get_irq_byname(pdev, "adcdone"); |
1014 | if (!ddata->irq) | 1014 | if (ddata->irq < 0) |
1015 | return -ENODEV; | 1015 | return -ENODEV; |
1016 | 1016 | ||
1017 | error = devm_request_threaded_irq(&pdev->dev, ddata->irq, NULL, | 1017 | error = devm_request_threaded_irq(&pdev->dev, ddata->irq, NULL, |