From: <Christian.Gromm@microchip.com>
To: <linux-kernel@vger.kernel.org>, <gregkh@linuxfoundation.org>,
<nishkadg.linux@gmail.com>, <devel@driverdev.osuosl.org>
Subject: Re: [PATCH] staging: most: usb: Remove variable frame_size
Date: Fri, 24 May 2019 07:43:34 +0000 [thread overview]
Message-ID: <1558684034.16425.5.camel@microchip.com> (raw)
In-Reply-To: <20190523132334.29611-1-nishkadg.linux@gmail.com>
On Do, 2019-05-23 at 18:53 +0530, Nishka Dasgupta wrote:
> External E-Mail
>
>
> Remove variable frame_size as its multiple usages are all independent
> of
> each other and so can be returned separately.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Acked-by: Christian Gromm <christian.gromm@microchip.com>
> ---
> drivers/staging/most/usb/usb.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/most/usb/usb.c
> b/drivers/staging/most/usb/usb.c
> index 360cb5b7a10b..751e82cf66c5 100644
> --- a/drivers/staging/most/usb/usb.c
> +++ b/drivers/staging/most/usb/usb.c
> @@ -186,32 +186,28 @@ static inline int start_sync_ep(struct
> usb_device *usb_dev, u16 ep)
> */
> static unsigned int get_stream_frame_size(struct most_channel_config
> *cfg)
> {
> - unsigned int frame_size = 0;
> unsigned int sub_size = cfg->subbuffer_size;
>
> if (!sub_size) {
> pr_warn("Misconfig: Subbuffer size zero.\n");
> - return frame_size;
> + return 0;
> }
> switch (cfg->data_type) {
> case MOST_CH_ISOC:
> - frame_size = AV_PACKETS_PER_XACT * sub_size;
> - break;
> + return AV_PACKETS_PER_XACT * sub_size;
> case MOST_CH_SYNC:
> if (cfg->packets_per_xact == 0) {
> pr_warn("Misconfig: Packets per XACT
> zero\n");
> - frame_size = 0;
> + return 0;
> } else if (cfg->packets_per_xact == 0xFF) {
> - frame_size = (USB_MTU / sub_size) *
> sub_size;
> + return (USB_MTU / sub_size) * sub_size;
> } else {
> - frame_size = cfg->packets_per_xact *
> sub_size;
> + return cfg->packets_per_xact * sub_size;
> }
> - break;
> default:
> pr_warn("Query frame size of non-streaming
> channel\n");
> - break;
> + return 0;
> }
> - return frame_size;
> }
>
> /**
prev parent reply other threads:[~2019-05-24 7:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 13:23 [PATCH] staging: most: usb: Remove variable frame_size Nishka Dasgupta
2019-05-23 16:51 ` Greg KH
2019-05-24 8:03 ` Christian.Gromm
2019-05-24 7:43 ` Christian.Gromm [this message]
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=1558684034.16425.5.camel@microchip.com \
--to=christian.gromm@microchip.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nishkadg.linux@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.