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@xxxxxxxxxxxxx> > --- > v2: > Reported-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > - 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@xxxxxxxxxx> > > 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 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel