iio: adc: xilinx: check return value of xadc_write_adc_reg
authorAditya Pakki <pakki001@umn.edu>
Thu, 27 Dec 2018 19:54:52 +0000 (13:54 -0600)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 5 Jan 2019 16:44:02 +0000 (16:44 +0000)
In function xadc_probe, xadc_write_adc_reg can return an error value
when write fails. The fix checks for the return value consistent with
other invocations of the latter function.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/xilinx-xadc-core.c

index 3f6be5ac049a864fcf792530afce1b909cc05f66..b13c61539d46baf3490be318342dac64b6b1dc4b 100644 (file)
@@ -1273,8 +1273,10 @@ static int xadc_probe(struct platform_device *pdev)
                        xadc->threshold[i] = 0xffff;
                else
                        xadc->threshold[i] = 0;
-               xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
+               ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
                        xadc->threshold[i]);
+               if (ret)
+                       goto err_free_irq;
        }
 
        /* Go to non-buffered mode */