ALSA: pcxhr: Fix assignment in if condition

PCI PCXHR 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-47-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2021-06-08 16:05:20 +02:00
parent 36f74c7ff9
commit 4327ad25e6
2 changed files with 20 additions and 11 deletions

View File

@ -1134,9 +1134,10 @@ int pcxhr_create_pcm(struct snd_pcxhr *chip)
char name[32];
snprintf(name, sizeof(name), "pcxhr %d", chip->chip_idx);
if ((err = snd_pcm_new(chip->card, name, 0,
chip->nb_streams_play,
chip->nb_streams_capt, &pcm)) < 0) {
err = snd_pcm_new(chip->card, name, 0,
chip->nb_streams_play,
chip->nb_streams_capt, &pcm);
if (err < 0) {
dev_err(chip->card->dev, "cannot create pcm %s\n", name);
return err;
}
@ -1202,7 +1203,8 @@ static int pcxhr_create(struct pcxhr_mgr *mgr,
chip->nb_streams_capt = 1; /* or 1 stereo stream */
}
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) {
pcxhr_chip_free(chip);
return err;
}
@ -1492,7 +1494,8 @@ static int pcxhr_probe(struct pci_dev *pci,
}
/* enable PCI device */
if ((err = pci_enable_device(pci)) < 0)
err = pci_enable_device(pci);
if (err < 0)
return err;
pci_set_master(pci);
@ -1537,7 +1540,8 @@ static int pcxhr_probe(struct pci_dev *pci,
mgr->granularity = PCXHR_GRANULARITY;
/* resource assignment */
if ((err = pci_request_regions(pci, card_name)) < 0) {
err = pci_request_regions(pci, card_name);
if (err < 0) {
kfree(mgr);
pci_disable_device(pci);
return err;
@ -1608,7 +1612,8 @@ static int pcxhr_probe(struct pci_dev *pci,
snprintf(card->longname, sizeof(card->longname),
"%s [PCM #%d]", mgr->name, i);
if ((err = pcxhr_create(mgr, card, i)) < 0) {
err = pcxhr_create(mgr, card, i);
if (err < 0) {
snd_card_free(card);
pcxhr_free(mgr);
return err;
@ -1618,7 +1623,8 @@ static int pcxhr_probe(struct pci_dev *pci,
/* init proc interface only for chip0 */
pcxhr_proc_init(mgr->chip[i]);
if ((err = snd_card_register(card)) < 0) {
err = snd_card_register(card);
if (err < 0) {
pcxhr_free(mgr);
return err;
}

View File

@ -322,14 +322,17 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index,
for (card_index = 0; card_index < mgr->num_cards; card_index++) {
struct snd_pcxhr *chip = mgr->chip[card_index];
if ((err = pcxhr_create_pcm(chip)) < 0)
err = pcxhr_create_pcm(chip);
if (err < 0)
return err;
if (card_index == 0) {
if ((err = pcxhr_create_mixer(chip->mgr)) < 0)
err = pcxhr_create_mixer(chip->mgr);
if (err < 0)
return err;
}
if ((err = snd_card_register(chip->card)) < 0)
err = snd_card_register(chip->card);
if (err < 0)
return err;
}
err = pcxhr_start_pipes(mgr);