Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: fix the return value handle for platform_get_irq()

There is no possible for platform_get_irq() to return 0
and the return value of platform_get_irq() is more sensible
to show the error reason.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230727131607.2897937-1-ruanjinjie@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Ruan Jinjie and committed by
Jonathan Cameron
c09ddcdd 49d73631

+8 -8
+2 -2
drivers/iio/adc/bcm_iproc_adc.c
··· 540 540 } 541 541 542 542 adc_priv->irqno = platform_get_irq(pdev, 0); 543 - if (adc_priv->irqno <= 0) 544 - return -ENODEV; 543 + if (adc_priv->irqno < 0) 544 + return adc_priv->irqno; 545 545 546 546 ret = regmap_update_bits(adc_priv->regmap, IPROC_REGCTL2, 547 547 IPROC_ADC_AUXIN_SCAN_ENA, 0);
+2 -2
drivers/iio/adc/lpc32xx_adc.c
··· 176 176 } 177 177 178 178 irq = platform_get_irq(pdev, 0); 179 - if (irq <= 0) 180 - return -ENXIO; 179 + if (irq < 0) 180 + return irq; 181 181 182 182 retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0, 183 183 LPC32XXAD_NAME, st);
+2 -2
drivers/iio/adc/npcm_adc.c
··· 244 244 info->adc_sample_hz = clk_get_rate(info->adc_clk) / ((div + 1) * 2); 245 245 246 246 irq = platform_get_irq(pdev, 0); 247 - if (irq <= 0) { 248 - ret = -EINVAL; 247 + if (irq < 0) { 248 + ret = irq; 249 249 goto err_disable_clk; 250 250 } 251 251
+2 -2
drivers/iio/adc/spear_adc.c
··· 310 310 } 311 311 312 312 irq = platform_get_irq(pdev, 0); 313 - if (irq <= 0) { 314 - ret = -EINVAL; 313 + if (irq < 0) { 314 + ret = irq; 315 315 goto errout2; 316 316 } 317 317