Re: [PATCH v2 1/3] USB: serial: return errors from break handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux