format.c (715a1284d89a740b197b3bad5eb20d36a397382f) format.c (fe773b8711e3be4190994ea54bf7a5a0564245a1)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 */
4
5#include <linux/init.h>
6#include <linux/slab.h>
7#include <linux/usb.h>
8#include <linux/usb/audio.h>

--- 452 unchanged lines hidden (view full) ---

461 struct audioformat *fp,
462 int clock)
463{
464 struct usb_device *dev = chip->dev;
465 unsigned int *table;
466 unsigned int nr_rates;
467 int i, err;
468
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 */
4
5#include <linux/init.h>
6#include <linux/slab.h>
7#include <linux/usb.h>
8#include <linux/usb/audio.h>

--- 452 unchanged lines hidden (view full) ---

461 struct audioformat *fp,
462 int clock)
463{
464 struct usb_device *dev = chip->dev;
465 unsigned int *table;
466 unsigned int nr_rates;
467 int i, err;
468
469 /* performing the rate verification may lead to unexpected USB bus
470 * behavior afterwards by some unknown reason. Do this only for the
471 * known devices.
472 */
473 switch (USB_ID_VENDOR(chip->usb_id)) {
474 case 0x07fd: /* MOTU */
475 break;
476 default:
477 return 0; /* don't perform the validation as default */
478 }
479
469 table = kcalloc(fp->nr_rates, sizeof(*table), GFP_KERNEL);
470 if (!table)
471 return -ENOMEM;
472
473 /* clear the interface altsetting at first */
474 usb_set_interface(dev, fp->iface, 0);
475
476 nr_rates = 0;

--- 333 unchanged lines hidden ---
480 table = kcalloc(fp->nr_rates, sizeof(*table), GFP_KERNEL);
481 if (!table)
482 return -ENOMEM;
483
484 /* clear the interface altsetting at first */
485 usb_set_interface(dev, fp->iface, 0);
486
487 nr_rates = 0;

--- 333 unchanged lines hidden ---