From: Felipe Balbi <balbi@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>,
bhumirks@gmail.com, mina86@mina86.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drivers: usb: gadget: udc: add missing break in switch
Date: Wed, 08 Feb 2017 15:13:25 +0200 [thread overview]
Message-ID: <878tpgygei.fsf@linux.intel.com> (raw)
In-Reply-To: <20170208130357.GC28327@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]
Hi,
Greg KH <gregkh@linuxfoundation.org> writes:
> On Wed, Feb 08, 2017 at 02:05:35PM +0200, Felipe Balbi wrote:
>>
>> Hi,
>>
>> "Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:
>> >> "Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:
>> >>> Add missing break in switch.
>> >>>
>> >>> Addresses-Coverity-ID: 201385
>> >>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> >>> ---
>> >>> drivers/usb/gadget/udc/mv_udc_core.c | 1 +
>> >>> 1 file changed, 1 insertion(+)
>> >>>
>> >>> diff --git a/drivers/usb/gadget/udc/mv_udc_core.c
>> >>> b/drivers/usb/gadget/udc/mv_udc_core.c
>> >>> index 27ebb0d..56b3574 100644
>> >>> --- a/drivers/usb/gadget/udc/mv_udc_core.c
>> >>> +++ b/drivers/usb/gadget/udc/mv_udc_core.c
>> >>> @@ -489,6 +489,7 @@ static int mv_ep_enable(struct usb_ep *_ep,
>> >>> break;
>> >>> case USB_ENDPOINT_XFER_CONTROL:
>> >>> ios = 1;
>> >>> + break;
>> >>
>> >> are you SURE this is supposed to have this break statement? What if we
>> >> want to initialize mult to 0 *also* for control endpoints? How did you
>> >> test this? Do you have access to Marvel's documentation for this
>> >> controller?
>> >>
>> >
>> > Certainly I wasn't sure, but I also think this is kind of obscure
>> > code. If that is the case that we also want to initialize mult to 0,
>> > wouldn't it be clearer (for maintenance purposes) to add mult = 0 and
>> > the break statement after ios = 1?
>> >
>> > What do you think if I modify that piece of code as follows:
>>
>> I think you need to test it, or get someone to test it for you :-)
>
> For crap code like this where it's "obvious" that something is wrong?
> That's really hard.
heh :-)
> How about a nice comment instead:
> /* Code path falls through, is it correct or not, who knows??? */
> which will make the static code checkers stop complaining about it, and
> if someone actually has the hardware, then they can test it.
works for me
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-02-08 13:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 7:22 [PATCH 1/2] drivers: usb: gadget: udc: add missing break in switch Gustavo A. R. Silva
2017-02-08 7:25 ` [PATCH 2/2] drivers: usb: gadget: udc: remove logically dead code Gustavo A. R. Silva
2017-02-08 9:23 ` [PATCH 1/2] drivers: usb: gadget: udc: add missing break in switch Felipe Balbi
2017-02-08 10:02 ` Gustavo A. R. Silva
2017-02-08 12:05 ` Felipe Balbi
2017-02-08 13:03 ` Greg KH
2017-02-08 13:13 ` Felipe Balbi [this message]
2017-02-08 13:16 ` Michal Nazarewicz
2017-02-08 13:21 ` Greg KH
2017-02-08 14:49 ` [PATCH] usb: gadget: mv_udc: clarify a switch with an implicit fall-through Michal Nazarewicz
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=878tpgygei.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=bhumirks@gmail.com \
--cc=garsilva@embeddedor.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mina86@mina86.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