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

USB: serial: ark3116: clean up return values of register accessors

write_reg returns 0 on success, we can make it more explicit by returning
number 0 instead of result variable.

read_reg should return 0 on success since this is a more common pattern.

The user of read_reg has been clean-up and should be at the same commit.

Signed-off-by: Gimcuan Hui <gimcuan@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>

authored by

Gimcuan Hui and committed by
Johan Hovold
d8a42b1f 5f0337b5

+7 -4
+7 -4
drivers/usb/serial/ark3116.c
··· 83 83 usb_sndctrlpipe(serial->dev, 0), 84 84 0xfe, 0x40, val, reg, 85 85 NULL, 0, ARK_TIMEOUT); 86 - return result; 86 + if (result) 87 + return result; 88 + 89 + return 0; 87 90 } 88 91 89 92 static int ark3116_read_reg(struct usb_serial *serial, ··· 108 105 return result; 109 106 } 110 107 111 - return buf[0]; 108 + return 0; 112 109 } 113 110 114 111 static inline int calc_divisor(int bps) ··· 358 355 359 356 /* read modem status */ 360 357 result = ark3116_read_reg(serial, UART_MSR, buf); 361 - if (result < 0) 358 + if (result) 362 359 goto err_close; 363 360 priv->msr = *buf; 364 361 365 362 /* read line status */ 366 363 result = ark3116_read_reg(serial, UART_LSR, buf); 367 - if (result < 0) 364 + if (result) 368 365 goto err_close; 369 366 priv->lsr = *buf; 370 367