[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 6 Jun 2023 13:13:30 +0200
From: Oliver Neukum <oneukum@...e.com>
To: Johan Hovold <johan@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Corey Minyard <minyard@....org>
Subject: Re: [PATCH v2 1/3] USB: serial: return errors from break handling
On 04.06.23 14:35, Johan Hovold wrote:
> @@ -1077,15 +1077,19 @@ static void pl2303_set_break(struct usb_serial_port *port, bool enable)
> result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
> BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
> 0, NULL, 0, 100);
> - if (result)
> + if (result) {
> dev_err(&port->dev, "error sending break = %d\n", result);
> + return result;
> + }
> +
> + return 0;
> }
Hi,
this code was always fishy, but I am afraid it worked by accident albeit
spamming the logs.
If I may quote from the kerneldoc of usb_control_msg():
* usb_control_msg - Builds a control urb, sends it off and waits for completion
[..]
* Return: If successful, the number of bytes transferred. Otherwise, a negative
* error number.
*/
You need to test for < 0, not != 0
Regards
Oliver
Powered by blists - more mailing lists