ALSA: es1938: Fix assignment in if condition

PCI ES1938 driver code contains a few 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-26-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2021-06-08 16:04:59 +02:00
parent 93a3a1004d
commit 3dc5281540
1 changed files with 28 additions and 14 deletions

View File

@ -293,7 +293,8 @@ static void snd_es1938_write_cmd(struct es1938 *chip, unsigned char cmd)
int i;
unsigned char v;
for (i = 0; i < WRITE_LOOP_TIMEOUT; i++) {
if (!(v = inb(SLSB_REG(chip, READSTATUS)) & 0x80)) {
v = inb(SLSB_REG(chip, READSTATUS));
if (!(v & 0x80)) {
outb(cmd, SLSB_REG(chip, WRITEDATA));
return;
}
@ -309,9 +310,11 @@ static int snd_es1938_get_byte(struct es1938 *chip)
{
int i;
unsigned char v;
for (i = GET_LOOP_TIMEOUT; i; i--)
if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80)
for (i = GET_LOOP_TIMEOUT; i; i--) {
v = inb(SLSB_REG(chip, STATUS));
if (v & 0x80)
return inb(SLSB_REG(chip, READDATA));
}
dev_err(chip->card->dev, "get_byte timeout: status 0x02%x\n", v);
return -ENODEV;
}
@ -993,7 +996,8 @@ static int snd_es1938_new_pcm(struct es1938 *chip, int device)
struct snd_pcm *pcm;
int err;
if ((err = snd_pcm_new(chip->card, "es-1938-1946", device, 2, 1, &pcm)) < 0)
err = snd_pcm_new(chip->card, "es-1938-1946", device, 2, 1, &pcm);
if (err < 0)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_es1938_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_es1938_capture_ops);
@ -1553,7 +1557,8 @@ static int snd_es1938_create(struct snd_card *card,
*rchip = NULL;
/* enable PCI device */
if ((err = pci_enable_device(pci)) < 0)
err = pci_enable_device(pci);
if (err < 0)
return err;
/* check, if we can restrict PCI DMA transfers to 24 bits */
if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(24))) {
@ -1573,7 +1578,8 @@ static int snd_es1938_create(struct snd_card *card,
chip->card = card;
chip->pci = pci;
chip->irq = -1;
if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) {
err = pci_request_regions(pci, "ESS Solo-1");
if (err < 0) {
kfree(chip);
pci_disable_device(pci);
return err;
@ -1599,7 +1605,8 @@ static int snd_es1938_create(struct snd_card *card,
snd_es1938_chip_init(chip);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
if (err < 0) {
snd_es1938_free(chip);
return err;
}
@ -1731,7 +1738,8 @@ static int snd_es1938_mixer(struct es1938 *chip)
kctl->private_free = snd_es1938_hwv_free;
break;
}
if ((err = snd_ctl_add(card, kctl)) < 0)
err = snd_ctl_add(card, kctl);
if (err < 0)
return err;
}
return 0;
@ -1765,7 +1773,8 @@ static int snd_es1938_probe(struct pci_dev *pci,
return -ENODEV;
}
}
if ((err = snd_es1938_create(card, pci, &chip)) < 0) {
err = snd_es1938_create(card, pci, &chip);
if (err < 0) {
snd_card_free(card);
return err;
}
@ -1778,11 +1787,13 @@ static int snd_es1938_probe(struct pci_dev *pci,
chip->revision,
chip->irq);
if ((err = snd_es1938_new_pcm(chip, 0)) < 0) {
err = snd_es1938_new_pcm(chip, 0);
if (err < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_es1938_mixer(chip)) < 0) {
err = snd_es1938_mixer(chip);
if (err < 0) {
snd_card_free(card);
return err;
}
@ -1793,11 +1804,13 @@ static int snd_es1938_probe(struct pci_dev *pci,
dev_err(card->dev, "OPL3 not detected at 0x%lx\n",
SLSB_REG(chip, FMLOWADDR));
} else {
if ((err = snd_opl3_timer_new(opl3, 0, 1)) < 0) {
err = snd_opl3_timer_new(opl3, 0, 1);
if (err < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (err < 0) {
snd_card_free(card);
return err;
}
@ -1815,7 +1828,8 @@ static int snd_es1938_probe(struct pci_dev *pci,
snd_es1938_create_gameport(chip);
if ((err = snd_card_register(card)) < 0) {
err = snd_card_register(card);
if (err < 0) {
snd_card_free(card);
return err;
}