OSDN Git Service

ALSA: compress: Replace complex if statement with switch
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Wed, 4 May 2016 13:59:11 +0000 (14:59 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 May 2016 15:35:50 +0000 (17:35 +0200)
A switch statement looks a bit cleaner than an if statement
spread over 3 lines, as such update this to a switch.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/compress_offload.c

index f56f4e3..9b3334b 100644 (file)
@@ -288,9 +288,12 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
        stream = &data->stream;
        mutex_lock(&stream->device->lock);
        /* write is allowed when stream is running or has been steup */
-       if (stream->runtime->state != SNDRV_PCM_STATE_SETUP &&
-           stream->runtime->state != SNDRV_PCM_STATE_PREPARED &&
-                       stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
+       switch (stream->runtime->state) {
+       case SNDRV_PCM_STATE_SETUP:
+       case SNDRV_PCM_STATE_PREPARED:
+       case SNDRV_PCM_STATE_RUNNING:
+               break;
+       default:
                mutex_unlock(&stream->device->lock);
                return -EBADFD;
        }