Commit 93a3a100 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ens137x: Fix assignment in if condition

PCI ENS137x 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-25-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 393e95cd
...@@ -672,7 +672,8 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97, ...@@ -672,7 +672,8 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
} }
/* now wait for the stinkin' data (RDY) */ /* now wait for the stinkin' data (RDY) */
for (t = 0; t < POLL_COUNT; t++) { for (t = 0; t < POLL_COUNT; t++) {
if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) { x = inl(ES_REG(ensoniq, 1371_CODEC));
if (x & ES_1371_CODEC_RDY) {
if (is_ev1938(ensoniq)) { if (is_ev1938(ensoniq)) {
for (t = 0; t < 100; t++) for (t = 0; t < 100; t++)
inl(ES_REG(ensoniq, CONTROL)); inl(ES_REG(ensoniq, CONTROL));
...@@ -1594,7 +1595,8 @@ static int snd_ensoniq_1371_mixer(struct ensoniq *ensoniq, ...@@ -1594,7 +1595,8 @@ static int snd_ensoniq_1371_mixer(struct ensoniq *ensoniq,
.wait = snd_es1371_codec_wait, .wait = snd_es1371_codec_wait,
}; };
if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0) err = snd_ac97_bus(card, 0, &ops, NULL, &pbus);
if (err < 0)
return err; return err;
memset(&ac97, 0, sizeof(ac97)); memset(&ac97, 0, sizeof(ac97));
...@@ -1602,7 +1604,8 @@ static int snd_ensoniq_1371_mixer(struct ensoniq *ensoniq, ...@@ -1602,7 +1604,8 @@ static int snd_ensoniq_1371_mixer(struct ensoniq *ensoniq,
ac97.private_free = snd_ensoniq_mixer_free_ac97; ac97.private_free = snd_ensoniq_mixer_free_ac97;
ac97.pci = ensoniq->pci; ac97.pci = ensoniq->pci;
ac97.scaps = AC97_SCAP_AUDIO; ac97.scaps = AC97_SCAP_AUDIO;
if ((err = snd_ac97_mixer(pbus, &ac97, &ensoniq->u.es1371.ac97)) < 0) err = snd_ac97_mixer(pbus, &ac97, &ensoniq->u.es1371.ac97);
if (err < 0)
return err; return err;
if (has_spdif > 0 || if (has_spdif > 0 ||
(!has_spdif && es1371_quirk_lookup(ensoniq, es1371_spdif_present))) { (!has_spdif && es1371_quirk_lookup(ensoniq, es1371_spdif_present))) {
...@@ -1722,7 +1725,8 @@ static int snd_ensoniq_1370_mixer(struct ensoniq *ensoniq) ...@@ -1722,7 +1725,8 @@ static int snd_ensoniq_1370_mixer(struct ensoniq *ensoniq)
ak4531.write = snd_es1370_codec_write; ak4531.write = snd_es1370_codec_write;
ak4531.private_data = ensoniq; ak4531.private_data = ensoniq;
ak4531.private_free = snd_ensoniq_mixer_free_ak4531; ak4531.private_free = snd_ensoniq_mixer_free_ak4531;
if ((err = snd_ak4531_mixer(card, &ak4531, &ensoniq->u.es1370.ak4531)) < 0) err = snd_ak4531_mixer(card, &ak4531, &ensoniq->u.es1370.ak4531);
if (err < 0)
return err; return err;
for (idx = 0; idx < ES1370_CONTROLS; idx++) { for (idx = 0; idx < ES1370_CONTROLS; idx++) {
err = snd_ctl_add(card, snd_ctl_new1(&snd_es1370_controls[idx], ensoniq)); err = snd_ctl_add(card, snd_ctl_new1(&snd_es1370_controls[idx], ensoniq));
...@@ -2038,7 +2042,8 @@ static int snd_ensoniq_create(struct snd_card *card, ...@@ -2038,7 +2042,8 @@ static int snd_ensoniq_create(struct snd_card *card,
}; };
*rensoniq = NULL; *rensoniq = NULL;
if ((err = pci_enable_device(pci)) < 0) err = pci_enable_device(pci);
if (err < 0)
return err; return err;
ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL); ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL);
if (ensoniq == NULL) { if (ensoniq == NULL) {
...@@ -2050,7 +2055,8 @@ static int snd_ensoniq_create(struct snd_card *card, ...@@ -2050,7 +2055,8 @@ static int snd_ensoniq_create(struct snd_card *card,
ensoniq->card = card; ensoniq->card = card;
ensoniq->pci = pci; ensoniq->pci = pci;
ensoniq->irq = -1; ensoniq->irq = -1;
if ((err = pci_request_regions(pci, "Ensoniq AudioPCI")) < 0) { err = pci_request_regions(pci, "Ensoniq AudioPCI");
if (err < 0) {
kfree(ensoniq); kfree(ensoniq);
pci_disable_device(pci); pci_disable_device(pci);
return err; return err;
...@@ -2095,7 +2101,8 @@ static int snd_ensoniq_create(struct snd_card *card, ...@@ -2095,7 +2101,8 @@ static int snd_ensoniq_create(struct snd_card *card,
snd_ensoniq_chip_init(ensoniq); snd_ensoniq_chip_init(ensoniq);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ensoniq, &ops)) < 0) { err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ensoniq, &ops);
if (err < 0) {
snd_ensoniq_free(ensoniq); snd_ensoniq_free(ensoniq);
return err; return err;
} }
...@@ -2286,7 +2293,8 @@ static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device) ...@@ -2286,7 +2293,8 @@ static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device)
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
int err; int err;
if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi);
if (err < 0)
return err; return err;
strcpy(rmidi->name, CHIP_NAME); strcpy(rmidi->name, CHIP_NAME);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output);
...@@ -2357,33 +2365,39 @@ static int snd_audiopci_probe(struct pci_dev *pci, ...@@ -2357,33 +2365,39 @@ static int snd_audiopci_probe(struct pci_dev *pci,
if (err < 0) if (err < 0)
return err; return err;
if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) { err = snd_ensoniq_create(card, pci, &ensoniq);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
card->private_data = ensoniq; card->private_data = ensoniq;
#ifdef CHIP1370 #ifdef CHIP1370
if ((err = snd_ensoniq_1370_mixer(ensoniq)) < 0) { err = snd_ensoniq_1370_mixer(ensoniq);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
#endif #endif
#ifdef CHIP1371 #ifdef CHIP1371
if ((err = snd_ensoniq_1371_mixer(ensoniq, spdif[dev], lineio[dev])) < 0) { err = snd_ensoniq_1371_mixer(ensoniq, spdif[dev], lineio[dev]);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
#endif #endif
if ((err = snd_ensoniq_pcm(ensoniq, 0)) < 0) { err = snd_ensoniq_pcm(ensoniq, 0);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_ensoniq_pcm2(ensoniq, 1)) < 0) { err = snd_ensoniq_pcm2(ensoniq, 1);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_ensoniq_midi(ensoniq, 0)) < 0) { err = snd_ensoniq_midi(ensoniq, 0);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
...@@ -2399,7 +2413,8 @@ static int snd_audiopci_probe(struct pci_dev *pci, ...@@ -2399,7 +2413,8 @@ static int snd_audiopci_probe(struct pci_dev *pci,
ensoniq->port, ensoniq->port,
ensoniq->irq); ensoniq->irq);
if ((err = snd_card_register(card)) < 0) { err = snd_card_register(card);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment