From: Johan Hovold <johan@kernel.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Corey Minyard <minyard@acm.org>
Subject: Re: [PATCH v2 1/3] USB: serial: return errors from break handling
Date: Tue, 6 Jun 2023 13:34:34 +0200 [thread overview]
Message-ID: <ZH8ZyjG_D1HiNay5@hovoldconsulting.com> (raw)
In-Reply-To: <88472624-cc92-31a7-f35d-a212e61ab959@suse.com>
Hi Oliver,
On Tue, Jun 06, 2023 at 01:13:30PM +0200, Oliver Neukum wrote:
> 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;
> > }
And thanks for taking a look.
> 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
No, the current code is just fine as there is no data stage so
usb_control_msg() returns 0 or negative errno.
Johan
next prev parent reply other threads:[~2023-06-06 11:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-04 12:35 [PATCH v2 0/3] " Johan Hovold
2023-06-04 12:35 ` [PATCH v2 1/3] " Johan Hovold
2023-06-06 11:13 ` Oliver Neukum
2023-06-06 11:34 ` Johan Hovold [this message]
2023-06-04 12:35 ` [PATCH v2 2/3] USB: serial: cp210x: disable break signalling on CP2105 SCI Johan Hovold
2023-06-04 12:35 ` [PATCH v2 3/3] USB: serial: report unsupported break signalling Johan Hovold
2023-06-04 20:19 ` [PATCH v2 0/3] USB: serial: return errors from break handling Corey Minyard
2023-06-06 11:18 ` Oliver Neukum
2023-06-06 11:39 ` Johan Hovold
2023-06-06 12:46 ` Corey Minyard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZH8ZyjG_D1HiNay5@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=minyard@acm.org \
--cc=oneukum@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®