mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
ALSA: es18xx: Fix assignment in if condition
ISA ES18xx 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-11-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
4b3bd108ab
commit
45e0471d64
1 changed files with 34 additions and 17 deletions
|
@ -1573,7 +1573,8 @@ static int snd_es18xx_identify(struct snd_es18xx *chip)
|
|||
udelay(10);
|
||||
chip->ctrl_port += inb(chip->port + 0x05);
|
||||
|
||||
if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) {
|
||||
chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL");
|
||||
if (!chip->res_ctrl_port) {
|
||||
snd_printk(KERN_ERR PFX "unable go grab port 0x%lx\n", chip->ctrl_port);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
@ -1832,41 +1833,48 @@ static int snd_es18xx_mixer(struct snd_card *card)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if ((err = snd_ctl_add(card, kctl)) < 0)
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (chip->caps & ES18XX_PCM2) {
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_pcm2_controls); idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm2_controls[idx], chip))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm2_controls[idx], chip));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_pcm1_controls); idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm1_controls[idx], chip))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm1_controls[idx], chip));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (chip->caps & ES18XX_RECMIX) {
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
switch (chip->version) {
|
||||
default:
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre1_control, chip))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre1_control, chip));
|
||||
if (err < 0)
|
||||
return err;
|
||||
break;
|
||||
case 0x1869:
|
||||
case 0x1879:
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre2_control, chip))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre2_control, chip));
|
||||
if (err < 0)
|
||||
return err;
|
||||
break;
|
||||
}
|
||||
if (chip->caps & ES18XX_SPATIALIZER) {
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_spatializer_controls); idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_spatializer_controls[idx], chip))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_spatializer_controls[idx], chip));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
@ -1879,7 +1887,8 @@ static int snd_es18xx_mixer(struct snd_card *card)
|
|||
else
|
||||
chip->hw_switch = kctl;
|
||||
kctl->private_free = snd_es18xx_hwv_free;
|
||||
if ((err = snd_ctl_add(card, kctl)) < 0)
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
}
|
||||
|
@ -2154,7 +2163,8 @@ static int snd_es18xx_isa_probe1(int dev, struct device *devptr)
|
|||
err = snd_es18xx_card_new(devptr, dev, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if ((err = snd_audiodrive_probe(card, dev)) < 0) {
|
||||
err = snd_audiodrive_probe(card, dev);
|
||||
if (err < 0) {
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
|
@ -2169,19 +2179,22 @@ static int snd_es18xx_isa_probe(struct device *pdev, unsigned int dev)
|
|||
static const int possible_dmas[] = {1, 0, 3, 5, -1};
|
||||
|
||||
if (irq[dev] == SNDRV_AUTO_IRQ) {
|
||||
if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) {
|
||||
irq[dev] = snd_legacy_find_free_irq(possible_irqs);
|
||||
if (irq[dev] < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
if (dma1[dev] == SNDRV_AUTO_DMA) {
|
||||
if ((dma1[dev] = snd_legacy_find_free_dma(possible_dmas)) < 0) {
|
||||
dma1[dev] = snd_legacy_find_free_dma(possible_dmas);
|
||||
if (dma1[dev] < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
if (dma2[dev] == SNDRV_AUTO_DMA) {
|
||||
if ((dma2[dev] = snd_legacy_find_free_dma(possible_dmas)) < 0) {
|
||||
dma2[dev] = snd_legacy_find_free_dma(possible_dmas);
|
||||
if (dma2[dev] < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
@ -2257,11 +2270,13 @@ static int snd_audiodrive_pnp_detect(struct pnp_dev *pdev,
|
|||
err = snd_es18xx_card_new(&pdev->dev, dev, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) {
|
||||
err = snd_audiodrive_pnp(dev, card->private_data, pdev);
|
||||
if (err < 0) {
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
if ((err = snd_audiodrive_probe(card, dev)) < 0) {
|
||||
err = snd_audiodrive_probe(card, dev);
|
||||
if (err < 0) {
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
|
@ -2315,11 +2330,13 @@ static int snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard,
|
|||
if (res < 0)
|
||||
return res;
|
||||
|
||||
if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) {
|
||||
res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid);
|
||||
if (res < 0) {
|
||||
snd_card_free(card);
|
||||
return res;
|
||||
}
|
||||
if ((res = snd_audiodrive_probe(card, dev)) < 0) {
|
||||
res = snd_audiodrive_probe(card, dev);
|
||||
if (res < 0) {
|
||||
snd_card_free(card);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue