From: Ian Abbott Date: Wed, 4 Jan 2017 10:55:39 +0000 (+0000) Subject: staging: comedi: daqboard2000: change daqboard2000_write_cpld() return value X-Git-Tag: v4.14-rc1~1455^2~405 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7680a227293676eec528e4ef966769e65275d697;p=platform%2Fkernel%2Flinux-rpi.git staging: comedi: daqboard2000: change daqboard2000_write_cpld() return value `daqboard2000_write_cpld()` currently returns 1 on success, or 0 on failure. Change it to return 0 on success, or `-EIO` on failure. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index f4c7380..d6f3026 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -491,12 +491,12 @@ static int daqboard2000_wait_cpld_init(struct comedi_device *dev) static int daqboard2000_write_cpld(struct comedi_device *dev, u16 data) { - int result = 0; + int result = -EIO; usleep_range(10, 20); writew(data, dev->mmio + DB2K_REG_CPLD_WDATA); if (readw(dev->mmio + DB2K_REG_CPLD_STATUS) & DB2K_CPLD_STATUS_INIT) - result = 1; + result = 0; return result; } @@ -547,10 +547,9 @@ static int daqboard2000_load_firmware(struct comedi_device *dev, for (; i < len; i += 2) { u16 data = (cpld_array[i] << 8) + cpld_array[i + 1]; - if (!daqboard2000_write_cpld(dev, data)) { - result = -EIO; + result = daqboard2000_write_cpld(dev, data); + if (result) break; - } } if (result == 0) { daqboard2000_reset_local_bus(dev);