From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: "heghedus.razvan@gmail.com" <heghedus.razvan@gmail.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>, Jun Li <jun.li@nxp.com>
Subject: Re: [PATCH] usb: misc: ehset: fix wrong if condition
Date: Wed, 26 Jul 2023 05:57:56 +0200 [thread overview]
Message-ID: <2023072629-referable-enchilada-16aa@gregkh> (raw)
In-Reply-To: <DB7PR04MB45050DD873B70F1A0F41D0CB8C00A@DB7PR04MB4505.eurprd04.prod.outlook.com>
On Wed, Jul 26, 2023 at 01:54:15AM +0000, Xu Yang wrote:
> > -----Original Message-----
> >
> > A negative number from ret means the host controller had failed to send
> > usb message and 0 means succeed. Therefore, the if logic is wrong here
> > and this patch will fix it.
> >
> > Fixes: f2b42379c576 ("usb: misc: ehset: Rework test mode entry")
> > cc: <stable@vger.kernel.org>
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > ---
> > drivers/usb/misc/ehset.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/usb/misc/ehset.c b/drivers/usb/misc/ehset.c
> > index 986d6589f053..36b6e9fa7ffb 100644
> > --- a/drivers/usb/misc/ehset.c
> > +++ b/drivers/usb/misc/ehset.c
> > @@ -77,7 +77,7 @@ static int ehset_probe(struct usb_interface *intf,
> > switch (test_pid) {
> > case TEST_SE0_NAK_PID:
> > ret = ehset_prepare_port_for_testing(hub_udev, portnum);
> > - if (!ret)
> > + if (ret < 0)
> > break;
> > ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
> > USB_RT_PORT, USB_PORT_FEAT_TEST,
> > @@ -86,7 +86,7 @@ static int ehset_probe(struct usb_interface *intf,
> > break;
> > case TEST_J_PID:
> > ret = ehset_prepare_port_for_testing(hub_udev, portnum);
> > - if (!ret)
> > + if (ret < 0)
> > break;
> > ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
> > USB_RT_PORT, USB_PORT_FEAT_TEST,
> > @@ -95,7 +95,7 @@ static int ehset_probe(struct usb_interface *intf,
> > break;
> > case TEST_K_PID:
> > ret = ehset_prepare_port_for_testing(hub_udev, portnum);
> > - if (!ret)
> > + if (ret < 0)
> > break;
> > ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
> > USB_RT_PORT, USB_PORT_FEAT_TEST,
> > @@ -104,7 +104,7 @@ static int ehset_probe(struct usb_interface *intf,
> > break;
> > case TEST_PACKET_PID:
> > ret = ehset_prepare_port_for_testing(hub_udev, portnum);
> > - if (!ret)
> > + if (ret < 0)
> > break;
> > ret = usb_control_msg_send(hub_udev, 0, USB_REQ_SET_FEATURE,
> > USB_RT_PORT, USB_PORT_FEAT_TEST,
> > --
> > 2.34.1
>
> A gentle ping.
Have you teted this? It feels odd that the code could be that broken,
how did it ever work in the first place?
thanks,
greg k-h
next prev parent reply other threads:[~2023-07-26 3:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 9:52 [PATCH] usb: misc: ehset: fix wrong if condition Xu Yang
2023-07-26 1:54 ` Xu Yang
2023-07-26 3:57 ` gregkh [this message]
2023-07-26 5:10 ` [EXT] " Xu Yang
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=2023072629-referable-enchilada-16aa@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=heghedus.razvan@gmail.com \
--cc=jun.li@nxp.com \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=xu.yang_2@nxp.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