Commit 235dc07a authored by Takashi Iwai's avatar Takashi Iwai

ALSA: cs423x: Fix assignment in if condition

ISA CS423x driver code contains lots of 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-8-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 520226e9
...@@ -339,11 +339,13 @@ static int snd_cs423x_probe(struct snd_card *card, int dev) ...@@ -339,11 +339,13 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
int err; int err;
acard = card->private_data; acard = card->private_data;
if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) {
if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) { acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB");
if (!acard->res_sb_port) {
printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]); printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]);
return -EBUSY; return -EBUSY;
} }
}
err = snd_cs4236_create(card, port[dev], cport[dev], err = snd_cs4236_create(card, port[dev], cport[dev],
irq[dev], irq[dev],
...@@ -393,7 +395,8 @@ static int snd_cs423x_probe(struct snd_card *card, int dev) ...@@ -393,7 +395,8 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
OPL3_HW_OPL3_CS, 0, &opl3) < 0) { OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
printk(KERN_WARNING IDENT ": OPL3 not detected\n"); printk(KERN_WARNING IDENT ": OPL3 not detected\n");
} else { } else {
if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (err < 0)
return err; return err;
} }
} }
...@@ -444,7 +447,8 @@ static int snd_cs423x_isa_probe(struct device *pdev, ...@@ -444,7 +447,8 @@ static int snd_cs423x_isa_probe(struct device *pdev,
err = snd_cs423x_card_new(pdev, dev, &card); err = snd_cs423x_card_new(pdev, dev, &card);
if (err < 0) if (err < 0)
return err; return err;
if ((err = snd_cs423x_probe(card, dev)) < 0) { err = snd_cs423x_probe(card, dev);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
...@@ -538,7 +542,8 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, ...@@ -538,7 +542,8 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_cs423x_probe(card, dev)) < 0) { err = snd_cs423x_probe(card, dev);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
...@@ -592,13 +597,15 @@ static int snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, ...@@ -592,13 +597,15 @@ static int snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
res = snd_cs423x_card_new(&pcard->card->dev, dev, &card); res = snd_cs423x_card_new(&pcard->card->dev, dev, &card);
if (res < 0) if (res < 0)
return res; return res;
if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) { res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid);
if (res < 0) {
printk(KERN_ERR "isapnp detection failed and probing for " IDENT printk(KERN_ERR "isapnp detection failed and probing for " IDENT
" is not supported\n"); " is not supported\n");
snd_card_free(card); snd_card_free(card);
return res; return res;
} }
if ((res = snd_cs423x_probe(card, dev)) < 0) { res = snd_cs423x_probe(card, dev);
if (res < 0) {
snd_card_free(card); snd_card_free(card);
return res; return res;
} }
......
...@@ -1030,12 +1030,14 @@ int snd_cs4236_mixer(struct snd_wss *chip) ...@@ -1030,12 +1030,14 @@ int snd_cs4236_mixer(struct snd_wss *chip)
if (chip->hardware == WSS_HW_CS4235 || if (chip->hardware == WSS_HW_CS4235 ||
chip->hardware == WSS_HW_CS4239) { chip->hardware == WSS_HW_CS4239) {
for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) { for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0) err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip));
if (err < 0)
return err; return err;
} }
} else { } else {
for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_controls); idx++) { for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_controls); idx++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_controls[idx], chip))) < 0) err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_controls[idx], chip));
if (err < 0)
return err; return err;
} }
} }
...@@ -1058,13 +1060,15 @@ int snd_cs4236_mixer(struct snd_wss *chip) ...@@ -1058,13 +1060,15 @@ int snd_cs4236_mixer(struct snd_wss *chip)
kcontrol = NULL; kcontrol = NULL;
} }
for (idx = 0; idx < count; idx++, kcontrol++) { for (idx = 0; idx < count; idx++, kcontrol++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0) err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip));
if (err < 0)
return err; return err;
} }
if (chip->hardware == WSS_HW_CS4237B || if (chip->hardware == WSS_HW_CS4237B ||
chip->hardware == WSS_HW_CS4238B) { chip->hardware == WSS_HW_CS4238B) {
for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) { for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0) err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip));
if (err < 0)
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