Commit 164b3dde authored by Takashi Iwai's avatar Takashi Iwai

ALSA: cs5535audio: Fix assignment in if condition

PCI CS5535 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-39-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent cbc2d997
......@@ -143,7 +143,8 @@ static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
.read = snd_cs5535audio_ac97_codec_read,
};
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;
memset(&ac97, 0, sizeof(ac97));
......@@ -155,7 +156,8 @@ static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
/* set any OLPC-specific scaps */
olpc_prequirks(card, &ac97);
if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97);
if (err < 0) {
dev_err(card->dev, "mixer failed\n");
return err;
}
......@@ -266,7 +268,8 @@ static int snd_cs5535audio_create(struct snd_card *card,
};
*rcs5535au = NULL;
if ((err = pci_enable_device(pci)) < 0)
err = pci_enable_device(pci);
if (err < 0)
return err;
if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) {
......@@ -286,7 +289,8 @@ static int snd_cs5535audio_create(struct snd_card *card,
cs5535au->pci = pci;
cs5535au->irq = -1;
if ((err = pci_request_regions(pci, "CS5535 Audio")) < 0) {
err = pci_request_regions(pci, "CS5535 Audio");
if (err < 0) {
kfree(cs5535au);
goto pcifail;
}
......@@ -304,8 +308,8 @@ static int snd_cs5535audio_create(struct snd_card *card,
card->sync_irq = cs5535au->irq;
pci_set_master(pci);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
cs5535au, &ops)) < 0)
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cs5535au, &ops);
if (err < 0)
goto sndfail;
*rcs5535au = cs5535au;
......@@ -340,15 +344,18 @@ static int snd_cs5535audio_probe(struct pci_dev *pci,
if (err < 0)
return err;
if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0)
err = snd_cs5535audio_create(card, pci, &cs5535au);
if (err < 0)
goto probefail_out;
card->private_data = cs5535au;
if ((err = snd_cs5535audio_mixer(cs5535au)) < 0)
err = snd_cs5535audio_mixer(cs5535au);
if (err < 0)
goto probefail_out;
if ((err = snd_cs5535audio_pcm(cs5535au)) < 0)
err = snd_cs5535audio_pcm(cs5535au);
if (err < 0)
goto probefail_out;
strcpy(card->driver, DRIVER_NAME);
......@@ -358,7 +365,8 @@ static int snd_cs5535audio_probe(struct pci_dev *pci,
card->shortname, card->driver,
cs5535au->port, cs5535au->irq);
if ((err = snd_card_register(card)) < 0)
err = snd_card_register(card);
if (err < 0)
goto probefail_out;
pci_set_drvdata(pci, card);
......
......@@ -87,8 +87,9 @@ static int snd_cs5535audio_playback_open(struct snd_pcm_substream *substream)
snd_pcm_limit_hw_rates(runtime);
cs5535au->playback_substream = substream;
runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK]);
if ((err = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
err = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
if (err < 0)
return err;
return 0;
......@@ -342,8 +343,9 @@ static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream)
snd_pcm_limit_hw_rates(runtime);
cs5535au->capture_substream = substream;
runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_CAPTURE]);
if ((err = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
err = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
if (err < 0)
return err;
olpc_capture_open(cs5535au->ac97);
return 0;
......
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