diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-06-08 16:04:35 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-06-09 17:29:35 +0200 |
commit | 10dc8ad5ffe8350d71e244b27900a1939d255fe7 (patch) | |
tree | dbe91dbd35aa7cdc919278083b5fa79b3af047fd /sound/isa/sb/sb16_csp.c | |
parent | ALSA: usb-audio: scarlett2: Read mux at init time (diff) | |
download | linux-dev-10dc8ad5ffe8350d71e244b27900a1939d255fe7.tar.xz linux-dev-10dc8ad5ffe8350d71e244b27900a1939d255fe7.zip |
ALSA: sb: Fix assignment in if condition
A lot of code for SB drivers is in a legacy style with assignment in
if condition. This also made harder to catch some bugs (e.g. the
commit 1c98f574403d "ALSA: emu8000: Fix a use after free in
snd_emu8000_create_mixer").
This patch fixes the coding style. All are rather simple conversions
and there should be no functional changes.
(The changes in snd_emu8000_new() for hw->res_port1, 2 and 3 are
slightly different from the older ones, but this shouldn't matter
much in practice.)
Link: https://lore.kernel.org/r/20210608140540.17885-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/sb/sb16_csp.c')
-rw-r--r-- | sound/isa/sb/sb16_csp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 4789345a8fdd..d6ce6b16421c 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c @@ -112,10 +112,12 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep) if (csp_detect(chip, &version)) return -ENODEV; - if ((err = snd_hwdep_new(chip->card, "SB16-CSP", device, &hw)) < 0) + err = snd_hwdep_new(chip->card, "SB16-CSP", device, &hw); + if (err < 0) return err; - if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) { + p = kzalloc(sizeof(*p), GFP_KERNEL); + if (!p) { snd_device_free(chip->card, hw); return -ENOMEM; } @@ -1045,11 +1047,15 @@ static int snd_sb_qsound_build(struct snd_sb_csp * p) spin_lock_init(&p->q_lock); - if ((err = snd_ctl_add(card, p->qsound_switch = snd_ctl_new1(&snd_sb_qsound_switch, p))) < 0) { + p->qsound_switch = snd_ctl_new1(&snd_sb_qsound_switch, p); + err = snd_ctl_add(card, p->qsound_switch); + if (err < 0) { p->qsound_switch = NULL; goto __error; } - if ((err = snd_ctl_add(card, p->qsound_space = snd_ctl_new1(&snd_sb_qsound_space, p))) < 0) { + p->qsound_space = snd_ctl_new1(&snd_sb_qsound_space, p); + err = snd_ctl_add(card, p->qsound_space); + if (err < 0) { p->qsound_space = NULL; goto __error; } |