]> git.baikalelectronics.ru Git - kernel.git/commit
USB: serial: f81534: detect errors from f81534_logic_to_phy_port()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Sun, 18 Dec 2016 09:19:28 +0000 (10:19 +0100)
committerJohan Hovold <johan@kernel.org>
Mon, 2 Jan 2017 09:31:08 +0000 (10:31 +0100)
commitf90e6564b17fb17ab6b51da6eb9d6ee0d70ff0e0
tree7a72996439dd2c52ba443262a4af93628ed151d9
parenta780c2d5637d959a6133b349d5166a4148a42da3
USB: serial: f81534: detect errors from f81534_logic_to_phy_port()

With gcc 4.1.2:

    drivers/usb/serial/f81534.c: In function ‘f81534_port_probe’:
    drivers/usb/serial/f81534.c:1250: warning: comparison is always false due to limited range of data type

f81534_logic_to_phy_port() may return a negative error value, which is
ignored by assigning it to u8 f81534_port_private.phy_num.

Use an intermediate variable of type int to fix this.
While at it, forward the actual error code instead of converting it to
-ENODEV, and drop the useless check for F81534_NUM_PORT, as the callee
always returns a valid port number in case of success.

Fixes: c0fdaefb9403c50d ("USB: serial: add Fintek F81532/534 driver")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/f81534.c