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