ALSA: cmi8330: Fix assignment in if condition

ISA CMI8330 driver code contains lots of assignments in if condition,
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-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2021-06-08 16:04:45 +02:00
parent 45e0471d64
commit 3e38150bf2

View File

@ -284,7 +284,8 @@ static int cmi8330_add_sb_mixers(struct snd_sb *chip)
}
for (idx = 0; idx < ARRAY_SIZE(cmi8330_sb_mixers); idx++) {
if ((err = snd_sbmixer_add_ctl_elem(chip, &cmi8330_sb_mixers[idx])) < 0)
err = snd_sbmixer_add_ctl_elem(chip, &cmi8330_sb_mixers[idx]);
if (err < 0)
return err;
}
return 0;
@ -307,7 +308,8 @@ static int snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard)
}
#ifdef ENABLE_SB_MIXER
if ((err = cmi8330_add_sb_mixers(acard->sb)) < 0)
err = cmi8330_add_sb_mixers(acard->sb);
if (err < 0)
return err;
#endif
return 0;
@ -432,7 +434,8 @@ static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)
snd_cmi8330_capture_open
};
if ((err = snd_pcm_new(card, (chip->type == CMI8329) ? "CMI8329" : "CMI8330", 0, 1, 1, &pcm)) < 0)
err = snd_pcm_new(card, (chip->type == CMI8329) ? "CMI8329" : "CMI8330", 0, 1, 1, &pcm);
if (err < 0)
return err;
strcpy(pcm->name, (chip->type == CMI8329) ? "CMI8329" : "CMI8330");
pcm->private_data = chip;
@ -536,12 +539,13 @@ static int snd_cmi8330_probe(struct snd_card *card, int dev)
return -ENODEV;
}
if ((err = snd_sbdsp_create(card, sbport[dev],
sbirq[dev],
snd_sb16dsp_interrupt,
sbdma8[dev],
sbdma16[dev],
SB_HW_AUTO, &acard->sb)) < 0) {
err = snd_sbdsp_create(card, sbport[dev],
sbirq[dev],
snd_sb16dsp_interrupt,
sbdma8[dev],
sbdma16[dev],
SB_HW_AUTO, &acard->sb);
if (err < 0) {
snd_printk(KERN_ERR PFX "SB16 device busy??\n");
return err;
}
@ -555,12 +559,14 @@ static int snd_cmi8330_probe(struct snd_card *card, int dev)
snd_wss_out(acard->wss, i,
snd_cmi8330_image[i - CMI8330_RMUX3D]);
if ((err = snd_cmi8330_mixer(card, acard)) < 0) {
err = snd_cmi8330_mixer(card, acard);
if (err < 0) {
snd_printk(KERN_ERR PFX "failed to create mixers\n");
return err;
}
if ((err = snd_cmi8330_pcm(card, acard)) < 0) {
err = snd_cmi8330_pcm(card, acard);
if (err < 0) {
snd_printk(KERN_ERR PFX "failed to create pcms\n");
return err;
}
@ -622,7 +628,8 @@ static int snd_cmi8330_isa_probe(struct device *pdev,
err = snd_cmi8330_card_new(pdev, dev, &card);
if (err < 0)
return err;
if ((err = snd_cmi8330_probe(card, dev)) < 0) {
err = snd_cmi8330_probe(card, dev);
if (err < 0) {
snd_card_free(card);
return err;
}
@ -683,12 +690,14 @@ static int snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
res = snd_cmi8330_card_new(&pcard->card->dev, dev, &card);
if (res < 0)
return res;
if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) {
res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid);
if (res < 0) {
snd_printk(KERN_ERR PFX "PnP detection failed\n");
snd_card_free(card);
return res;
}
if ((res = snd_cmi8330_probe(card, dev)) < 0) {
res = snd_cmi8330_probe(card, dev);
if (res < 0) {
snd_card_free(card);
return res;
}