diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 9bde11d1cfe8..6f42f869928c 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -208,7 +208,8 @@ static int snd_opl3sa2_detect(struct snd_card *card) char str[2]; port = chip->port; - if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { + chip->res_port = request_region(port, 2, "OPL3-SA control"); + if (!chip->res_port) { snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); return -EBUSY; } @@ -239,14 +240,16 @@ static int snd_opl3sa2_detect(struct snd_card *card) str[1] = 0; strcat(card->shortname, str); snd_opl3sa2_write(chip, OPL3SA2_MISC, tmp ^ 7); - if ((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MISC)) != tmp) { + tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MISC); + if (tmp1 != tmp) { snd_printd("OPL3-SA [0x%lx] detect (1) = 0x%x (0x%x)\n", port, tmp, tmp1); return -ENODEV; } /* try if the MIC register is accessible */ tmp = snd_opl3sa2_read(chip, OPL3SA2_MIC); snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x8a); - if (((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MIC)) & 0x9f) != 0x8a) { + tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MIC); + if ((tmp1 & 0x9f) != 0x8a) { snd_printd("OPL3-SA [0x%lx] detect (2) = 0x%x (0x%x)\n", port, tmp, tmp1); return -ENODEV; } @@ -489,32 +492,38 @@ static int snd_opl3sa2_mixer(struct snd_card *card) /* reassign AUX0 to CD */ strcpy(id1.name, "Aux Playback Switch"); strcpy(id2.name, "CD Playback Switch"); - if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { + err = snd_ctl_rename_id(card, &id1, &id2); + if (err < 0) { snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); return err; } strcpy(id1.name, "Aux Playback Volume"); strcpy(id2.name, "CD Playback Volume"); - if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { + err = snd_ctl_rename_id(card, &id1, &id2); + if (err < 0) { snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); return err; } /* reassign AUX1 to FM */ strcpy(id1.name, "Aux Playback Switch"); id1.index = 1; strcpy(id2.name, "FM Playback Switch"); - if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { + err = snd_ctl_rename_id(card, &id1, &id2); + if (err < 0) { snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); return err; } strcpy(id1.name, "Aux Playback Volume"); strcpy(id2.name, "FM Playback Volume"); - if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { + err = snd_ctl_rename_id(card, &id1, &id2); + if (err < 0) { snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); return err; } /* add OPL3SA2 controls */ for (idx = 0; idx < ARRAY_SIZE(snd_opl3sa2_controls); idx++) { - if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_opl3sa2_controls[idx], chip))) < 0) + kctl = snd_ctl_new1(&snd_opl3sa2_controls[idx], chip); + err = snd_ctl_add(card, kctl); + if (err < 0) return err; switch (idx) { case 0: chip->master_switch = kctl; kctl->private_free = snd_opl3sa2_master_free; break; @@ -522,9 +531,11 @@ static int snd_opl3sa2_mixer(struct snd_card *card) } } if (chip->version > 2) { - for (idx = 0; idx < ARRAY_SIZE(snd_opl3sa2_tone_controls); idx++) - if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_opl3sa2_tone_controls[idx], chip))) < 0) + for (idx = 0; idx < ARRAY_SIZE(snd_opl3sa2_tone_controls); idx++) { + err = snd_ctl_add(card, snd_ctl_new1(&snd_opl3sa2_tone_controls[idx], chip)); + if (err < 0) return err; + } } return 0; } @@ -677,20 +688,24 @@ static int snd_opl3sa2_probe(struct snd_card *card, int dev) if (err < 0) return err; if (fm_port[dev] >= 0x340 && fm_port[dev] < 0x400) { - if ((err = snd_opl3_create(card, fm_port[dev], - fm_port[dev] + 2, - OPL3_HW_OPL3, 0, &opl3)) < 0) + err = snd_opl3_create(card, fm_port[dev], + fm_port[dev] + 2, + OPL3_HW_OPL3, 0, &opl3); + if (err < 0) return err; - if ((err = snd_opl3_timer_new(opl3, 1, 2)) < 0) + err = snd_opl3_timer_new(opl3, 1, 2); + if (err < 0) return err; - if ((err = snd_opl3_hwdep_new(opl3, 0, 1, &chip->synth)) < 0) + err = snd_opl3_hwdep_new(opl3, 0, 1, &chip->synth); + if (err < 0) return err; } if (midi_port[dev] >= 0x300 && midi_port[dev] < 0x340) { - if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2, - midi_port[dev], - MPU401_INFO_IRQ_HOOK, -1, - &chip->rmidi)) < 0) + err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2, + midi_port[dev], + MPU401_INFO_IRQ_HOOK, -1, + &chip->rmidi); + if (err < 0) return err; } sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", @@ -721,11 +736,13 @@ static int snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, err = snd_opl3sa2_card_new(&pdev->dev, dev, &card); if (err < 0) return err; - if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { + err = snd_opl3sa2_pnp(dev, card->private_data, pdev); + if (err < 0) { snd_card_free(card); return err; } - if ((err = snd_opl3sa2_probe(card, dev)) < 0) { + err = snd_opl3sa2_probe(card, dev); + if (err < 0) { snd_card_free(card); return err; } @@ -785,11 +802,13 @@ static int snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, err = snd_opl3sa2_card_new(&pdev->dev, dev, &card); if (err < 0) return err; - if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { + err = snd_opl3sa2_pnp(dev, card->private_data, pdev); + if (err < 0) { snd_card_free(card); return err; } - if ((err = snd_opl3sa2_probe(card, dev)) < 0) { + err = snd_opl3sa2_probe(card, dev); + if (err < 0) { snd_card_free(card); return err; } @@ -865,7 +884,8 @@ static int snd_opl3sa2_isa_probe(struct device *pdev, err = snd_opl3sa2_card_new(pdev, dev, &card); if (err < 0) return err; - if ((err = snd_opl3sa2_probe(card, dev)) < 0) { + err = snd_opl3sa2_probe(card, dev); + if (err < 0) { snd_card_free(card); return err; }