diff options
Diffstat (limited to 'sound/firewire/bebob/bebob.c')
| -rw-r--r-- | sound/firewire/bebob/bebob.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index 2ba5962beb30..01e2c4cc03d4 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c @@ -105,9 +105,9 @@ name_device(struct snd_bebob *bebob) if (err < 0) goto end; - strcpy(bebob->card->driver, "BeBoB"); - strcpy(bebob->card->shortname, model); - strcpy(bebob->card->mixername, model); + strscpy(bebob->card->driver, "BeBoB"); + strscpy(bebob->card->shortname, model); + strscpy(bebob->card->mixername, model); snprintf(bebob->card->longname, sizeof(bebob->card->longname), "%s %s (id:%d, rev:%d), GUID %08x%08x at %s, S%d", vendor, model, hw_id, revision, @@ -122,9 +122,9 @@ bebob_card_free(struct snd_card *card) { struct snd_bebob *bebob = card->private_data; - mutex_lock(&devices_mutex); - clear_bit(bebob->card_index, devices_used); - mutex_unlock(&devices_mutex); + scoped_guard(mutex, &devices_mutex) { + clear_bit(bebob->card_index, devices_used); + } snd_bebob_stream_destroy_duplex(bebob); @@ -207,25 +207,21 @@ static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *en return -ENODEV; } - mutex_lock(&devices_mutex); - for (card_index = 0; card_index < SNDRV_CARDS; card_index++) { - if (!test_bit(card_index, devices_used) && enable[card_index]) - break; - } - if (card_index >= SNDRV_CARDS) { - mutex_unlock(&devices_mutex); - return -ENOENT; - } + scoped_guard(mutex, &devices_mutex) { + for (card_index = 0; card_index < SNDRV_CARDS; card_index++) { + if (!test_bit(card_index, devices_used) && enable[card_index]) + break; + } + if (card_index >= SNDRV_CARDS) + return -ENOENT; - err = snd_card_new(&unit->device, index[card_index], id[card_index], THIS_MODULE, - sizeof(*bebob), &card); - if (err < 0) { - mutex_unlock(&devices_mutex); - return err; + err = snd_card_new(&unit->device, index[card_index], id[card_index], THIS_MODULE, + sizeof(*bebob), &card); + if (err < 0) + return err; + card->private_free = bebob_card_free; + set_bit(card_index, devices_used); } - card->private_free = bebob_card_free; - set_bit(card_index, devices_used); - mutex_unlock(&devices_mutex); bebob = card->private_data; bebob->unit = fw_unit_get(unit); |
