There are a few places doing assignments in if condition in ALSA PCM
core code, which is a bad coding style that may confuse readers and
occasionally lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-55-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
        struct snd_pcm_runtime *runtime;
        int err;
 
-       if (! (runtime = substream->runtime))
+       runtime = substream->runtime;
+       if (!runtime)
                return -ENOTTY;
 
        data = kmalloc(sizeof(*data), GFP_KERNEL);
        if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN)
                return -EBADFD;
 
-       if ((ch = substream->runtime->channels) > 128)
+       ch = substream->runtime->channels;
+       if (ch > 128)
                return -EINVAL;
        if (get_user(buf, &data32->bufs) ||
            get_user(frames, &data32->frames))
 
        int val;
        if (!valid_format(format))
                return -EINVAL;
-       if ((val = pcm_formats[(INT)format].signd) < 0)
+       val = pcm_formats[(INT)format].signd;
+       if (val < 0)
                return -EINVAL;
        return val;
 }
        int val;
        if (!valid_format(format))
                return -EINVAL;
-       if ((val = pcm_formats[(INT)format].le) < 0)
+       val = pcm_formats[(INT)format].le;
+       if (val < 0)
                return -EINVAL;
        return val;
 }
        int val;
        if (!valid_format(format))
                return -EINVAL;
-       if ((val = pcm_formats[(INT)format].width) == 0)
+       val = pcm_formats[(INT)format].width;
+       if (!val)
                return -EINVAL;
        return val;
 }
        int val;
        if (!valid_format(format))
                return -EINVAL;
-       if ((val = pcm_formats[(INT)format].phys) == 0)
+       val = pcm_formats[(INT)format].phys;
+       if (!val)
                return -EINVAL;
        return val;
 }
 
 
        if (cpu_latency_qos_request_active(&substream->latency_pm_qos_req))
                cpu_latency_qos_remove_request(&substream->latency_pm_qos_req);
-       if ((usecs = period_to_usecs(runtime)) >= 0)
+       usecs = period_to_usecs(runtime);
+       if (usecs >= 0)
                cpu_latency_qos_add_request(&substream->latency_pm_qos_req,
                                            usecs);
        return 0;
                goto error;
        }
 
-       if ((err = substream->ops->open(substream)) < 0)
+       err = substream->ops->open(substream);
+       if (err < 0)
                goto error;
 
        substream->hw_opened = 1;