diff options
Diffstat (limited to 'sound/firewire/fireface/ff-hwdep.c')
| -rw-r--r-- | sound/firewire/fireface/ff-hwdep.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/sound/firewire/fireface/ff-hwdep.c b/sound/firewire/fireface/ff-hwdep.c index 8a741b3b0436..5976abf2e1ab 100644 --- a/sound/firewire/fireface/ff-hwdep.c +++ b/sound/firewire/fireface/ff-hwdep.c @@ -72,18 +72,14 @@ static __poll_t hwdep_poll(struct snd_hwdep *hwdep, struct file *file, poll_table *wait) { struct snd_ff *ff = hwdep->private_data; - __poll_t events; poll_wait(file, &ff->hwdep_wait, wait); - spin_lock_irq(&ff->lock); + guard(spinlock_irq)(&ff->lock); if (ff->dev_lock_changed || has_msg(ff)) - events = EPOLLIN | EPOLLRDNORM; + return EPOLLIN | EPOLLRDNORM; else - events = 0; - spin_unlock_irq(&ff->lock); - - return events; + return 0; } static int hwdep_get_info(struct snd_ff *ff, void __user *arg) @@ -107,48 +103,35 @@ static int hwdep_get_info(struct snd_ff *ff, void __user *arg) static int hwdep_lock(struct snd_ff *ff) { - int err; - - spin_lock_irq(&ff->lock); + guard(spinlock_irq)(&ff->lock); if (ff->dev_lock_count == 0) { ff->dev_lock_count = -1; - err = 0; + return 0; } else { - err = -EBUSY; + return -EBUSY; } - - spin_unlock_irq(&ff->lock); - - return err; } static int hwdep_unlock(struct snd_ff *ff) { - int err; - - spin_lock_irq(&ff->lock); + guard(spinlock_irq)(&ff->lock); if (ff->dev_lock_count == -1) { ff->dev_lock_count = 0; - err = 0; + return 0; } else { - err = -EBADFD; + return -EBADFD; } - - spin_unlock_irq(&ff->lock); - - return err; } static int hwdep_release(struct snd_hwdep *hwdep, struct file *file) { struct snd_ff *ff = hwdep->private_data; - spin_lock_irq(&ff->lock); + guard(spinlock_irq)(&ff->lock); if (ff->dev_lock_count == -1) ff->dev_lock_count = 0; - spin_unlock_irq(&ff->lock); return 0; } @@ -197,7 +180,7 @@ int snd_ff_create_hwdep_devices(struct snd_ff *ff) if (err < 0) return err; - strcpy(hwdep->name, ff->card->driver); + strscpy(hwdep->name, ff->card->driver); hwdep->iface = SNDRV_HWDEP_IFACE_FW_FIREFACE; hwdep->ops = hwdep_ops; hwdep->private_data = ff; |
