diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-25 12:41:26 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-28 01:22:16 -0500 |
commit | d6ca69d82522cb0e59777deea3673c85c7db7f45 (patch) | |
tree | 8d8c17684038092645cc2ff497ff2c266d703df1 /sound/usb | |
parent | aca514b82356dcc3575da33453382bd27593aea1 (diff) |
ALSA: line6: Minor tidy up in line6_probe()
Move the check of multi configurations before snd_card_new() as a
short path, and reduce superfluous pointer references.
Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/line6/driver.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index c696f9773cbb..a0436993a167 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c | |||
@@ -495,6 +495,10 @@ int line6_probe(struct usb_interface *interface, | |||
495 | if (WARN_ON(data_size < sizeof(*line6))) | 495 | if (WARN_ON(data_size < sizeof(*line6))) |
496 | return -EINVAL; | 496 | return -EINVAL; |
497 | 497 | ||
498 | /* we don't handle multiple configurations */ | ||
499 | if (usbdev->descriptor.bNumConfigurations != 1) | ||
500 | return -ENODEV; | ||
501 | |||
498 | ret = snd_card_new(&interface->dev, | 502 | ret = snd_card_new(&interface->dev, |
499 | SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, | 503 | SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, |
500 | THIS_MODULE, data_size, &card); | 504 | THIS_MODULE, data_size, &card); |
@@ -508,10 +512,10 @@ int line6_probe(struct usb_interface *interface, | |||
508 | line6->usbdev = usbdev; | 512 | line6->usbdev = usbdev; |
509 | line6->ifcdev = &interface->dev; | 513 | line6->ifcdev = &interface->dev; |
510 | 514 | ||
511 | strcpy(card->id, line6->properties->id); | 515 | strcpy(card->id, properties->id); |
512 | strcpy(card->driver, DRIVER_NAME); | 516 | strcpy(card->driver, DRIVER_NAME); |
513 | strcpy(card->shortname, line6->properties->name); | 517 | strcpy(card->shortname, properties->name); |
514 | sprintf(card->longname, "Line 6 %s at USB %s", line6->properties->name, | 518 | sprintf(card->longname, "Line 6 %s at USB %s", properties->name, |
515 | dev_name(line6->ifcdev)); | 519 | dev_name(line6->ifcdev)); |
516 | card->private_free = line6_destruct; | 520 | card->private_free = line6_destruct; |
517 | 521 | ||
@@ -520,12 +524,6 @@ int line6_probe(struct usb_interface *interface, | |||
520 | /* increment reference counters: */ | 524 | /* increment reference counters: */ |
521 | usb_get_dev(usbdev); | 525 | usb_get_dev(usbdev); |
522 | 526 | ||
523 | /* we don't handle multiple configurations */ | ||
524 | if (usbdev->descriptor.bNumConfigurations != 1) { | ||
525 | ret = -ENODEV; | ||
526 | goto error; | ||
527 | } | ||
528 | |||
529 | /* initialize device info: */ | 527 | /* initialize device info: */ |
530 | dev_info(&interface->dev, "Line 6 %s found\n", properties->name); | 528 | dev_info(&interface->dev, "Line 6 %s found\n", properties->name); |
531 | 529 | ||
@@ -533,7 +531,7 @@ int line6_probe(struct usb_interface *interface, | |||
533 | interface_number = interface->cur_altsetting->desc.bInterfaceNumber; | 531 | interface_number = interface->cur_altsetting->desc.bInterfaceNumber; |
534 | 532 | ||
535 | ret = usb_set_interface(usbdev, interface_number, | 533 | ret = usb_set_interface(usbdev, interface_number, |
536 | properties->altsetting); | 534 | properties->altsetting); |
537 | if (ret < 0) { | 535 | if (ret < 0) { |
538 | dev_err(&interface->dev, "set_interface failed\n"); | 536 | dev_err(&interface->dev, "set_interface failed\n"); |
539 | goto error; | 537 | goto error; |
@@ -555,7 +553,7 @@ int line6_probe(struct usb_interface *interface, | |||
555 | /* creation of additional special files should go here */ | 553 | /* creation of additional special files should go here */ |
556 | 554 | ||
557 | dev_info(&interface->dev, "Line 6 %s now attached\n", | 555 | dev_info(&interface->dev, "Line 6 %s now attached\n", |
558 | line6->properties->name); | 556 | properties->name); |
559 | 557 | ||
560 | return 0; | 558 | return 0; |
561 | 559 | ||