Skip to content

Commit

Permalink
ALSA: sparc: Fix assignment in if condition
Browse files Browse the repository at this point in the history
SPARC drivers contain 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-59-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
tiwai committed Jun 9, 2021
1 parent 2073fa4 commit bdab9e5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
14 changes: 9 additions & 5 deletions sound/sparc/amd7930.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,9 @@ static int snd_amd7930_create(struct snd_card *card,

spin_unlock_irqrestore(&amd->lock, flags);

if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
amd, &snd_amd7930_dev_ops)) < 0) {
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
amd, &snd_amd7930_dev_ops);
if (err < 0) {
snd_amd7930_free(amd);
return err;
}
Expand Down Expand Up @@ -1019,13 +1020,16 @@ static int amd7930_sbus_probe(struct platform_device *op)
irq, dev_num, &amd)) < 0)
goto out_err;

if ((err = snd_amd7930_pcm(amd)) < 0)
err = snd_amd7930_pcm(amd);
if (err < 0)
goto out_err;

if ((err = snd_amd7930_mixer(amd)) < 0)
err = snd_amd7930_mixer(amd);
if (err < 0)
goto out_err;

if ((err = snd_card_register(card)) < 0)
err = snd_card_register(card);
if (err < 0)
goto out_err;

amd->next = amd7930_list;
Expand Down
10 changes: 6 additions & 4 deletions sound/sparc/cs4231.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,8 +1828,9 @@ static int snd_cs4231_sbus_create(struct snd_card *card,
}
snd_cs4231_init(chip);

if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
chip, &snd_cs4231_sbus_dev_ops)) < 0) {
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
chip, &snd_cs4231_sbus_dev_ops);
if (err < 0) {
snd_cs4231_sbus_free(chip);
return err;
}
Expand Down Expand Up @@ -2020,8 +2021,9 @@ static int snd_cs4231_ebus_create(struct snd_card *card,
}
snd_cs4231_init(chip);

if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
chip, &snd_cs4231_ebus_dev_ops)) < 0) {
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
chip, &snd_cs4231_ebus_dev_ops);
if (err < 0) {
snd_cs4231_ebus_free(chip);
return err;
}
Expand Down
11 changes: 6 additions & 5 deletions sound/sparc/dbri.c
Original file line number Diff line number Diff line change
Expand Up @@ -2226,11 +2226,12 @@ static int snd_dbri_pcm(struct snd_card *card)
struct snd_pcm *pcm;
int err;

if ((err = snd_pcm_new(card,
/* ID */ "sun_dbri",
/* device */ 0,
/* playback count */ 1,
/* capture count */ 1, &pcm)) < 0)
err = snd_pcm_new(card,
/* ID */ "sun_dbri",
/* device */ 0,
/* playback count */ 1,
/* capture count */ 1, &pcm);
if (err < 0)
return err;

snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_dbri_ops);
Expand Down

0 comments on commit bdab9e5

Please sign in to comment.