All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Christian Gromm <christian.gromm@microchip.com>
Cc: gregkh@linuxfoundation.org,
	driverdev-devel@linuxdriverproject.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH v4] drivers: most: add USB adapter driver
Date: Wed, 27 May 2020 16:52:24 +0300	[thread overview]
Message-ID: <20200527135224.GC30374@kadam> (raw)
In-Reply-To: <1590585268-25423-1-git-send-email-christian.gromm@microchip.com>

On Wed, May 27, 2020 at 03:14:28PM +0200, Christian Gromm wrote:
> This patch adds the usb driver source file most_usb.c and
> modifies the Makefile and Kconfig accordingly.
> 
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
> ---
> v2:
> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>         - don't remove usb driver from staging area
>         - don't touch staging/most/Kconfig
>         - remove subdirectory for USB driver and put source file into
>           drivers/most
> v3:
>         - submitted fixes found during code audit to staging version
>           first to be able to resend single patch that adds the driver
> v4:
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 	
>         submitted patch set that fixes issues found during code audit
> 	to staging version first to be able to resend single patch that
> 	adds the driver. The patch series included:
> 
> 	- use function sysfs_streq
> 	- add missing put_device calls
> 	- use correct error codes
> 	- replace code to calculate array index
> 	- don't use error path to exit function on success
> 	- move allocation of URB out of critical section
> 	- return 0 instead of variable
> 	- change return value of function drci_rd_reg
> 	- don't use expressions that might fail in a declaration
> 	- change order of function parameters

Thanks for doing this.  I'm sorry that I am behind on reviewing code so
I hadn't gotten to that patchset yet.

> +static unsigned int get_stream_frame_size(struct device *dev,
> +					  struct most_channel_config *cfg)
> +{
> +	unsigned int frame_size;
> +	unsigned int sub_size = cfg->subbuffer_size;
> +
> +	if (!sub_size) {
> +		dev_warn(dev, "Misconfig: Subbuffer size zero.\n");
> +		return 0;
> +	}
> +	switch (cfg->data_type) {
> +	case MOST_CH_ISOC:
> +		frame_size = AV_PACKETS_PER_XACT * sub_size;
> +		break;
> +	case MOST_CH_SYNC:
> +		if (cfg->packets_per_xact == 0) {
> +			dev_warn(dev, "Misconfig: Packets per XACT zero\n");
> +			frame_size = 0;
> +		} else if (cfg->packets_per_xact == 0xFF) {
> +			frame_size = (USB_MTU / sub_size) * sub_size;
> +		} else {
> +			frame_size = cfg->packets_per_xact * sub_size;
> +		}
> +		break;
> +	default:
> +		dev_warn(dev, "Query frame size of non-streaming channel\n");
> +		break;

frame_size isn't initialized on this path.

> +	}
> +	return frame_size;
> +}

regards,
dan carpenter


  reply	other threads:[~2020-05-27 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 13:14 [PATCH v4] drivers: most: add USB adapter driver Christian Gromm
2020-05-27 13:52 ` Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-05-31  3:25 kbuild test robot

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=20200527135224.GC30374@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=christian.gromm@microchip.com \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /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.