Commit e2e30a32 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ad1889: Fix assignment in if condition

PCI AD1889 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-16-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent eb767949
...@@ -852,7 +852,8 @@ snd_ad1889_create(struct snd_card *card, ...@@ -852,7 +852,8 @@ snd_ad1889_create(struct snd_card *card,
*rchip = NULL; *rchip = NULL;
if ((err = pci_enable_device(pci)) < 0) err = pci_enable_device(pci);
if (err < 0)
return err; return err;
/* check PCI availability (32bit DMA) */ /* check PCI availability (32bit DMA) */
...@@ -863,7 +864,8 @@ snd_ad1889_create(struct snd_card *card, ...@@ -863,7 +864,8 @@ snd_ad1889_create(struct snd_card *card,
} }
/* allocate chip specific data with zero-filled memory */ /* allocate chip specific data with zero-filled memory */
if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) { chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (!chip) {
pci_disable_device(pci); pci_disable_device(pci);
return -ENOMEM; return -ENOMEM;
} }
...@@ -874,7 +876,8 @@ snd_ad1889_create(struct snd_card *card, ...@@ -874,7 +876,8 @@ snd_ad1889_create(struct snd_card *card,
chip->irq = -1; chip->irq = -1;
/* (1) PCI resource allocation */ /* (1) PCI resource allocation */
if ((err = pci_request_regions(pci, card->driver)) < 0) err = pci_request_regions(pci, card->driver);
if (err < 0)
goto free_and_ret; goto free_and_ret;
chip->bar = pci_resource_start(pci, 0); chip->bar = pci_resource_start(pci, 0);
...@@ -900,12 +903,14 @@ snd_ad1889_create(struct snd_card *card, ...@@ -900,12 +903,14 @@ snd_ad1889_create(struct snd_card *card,
card->sync_irq = chip->irq; card->sync_irq = chip->irq;
/* (2) initialization of the chip hardware */ /* (2) initialization of the chip hardware */
if ((err = snd_ad1889_init(chip)) < 0) { err = snd_ad1889_init(chip);
if (err < 0) {
snd_ad1889_free(chip); snd_ad1889_free(chip);
return err; return err;
} }
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_ad1889_free(chip); snd_ad1889_free(chip);
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