Commit 61ea06e8 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: als4000: Fix assignment in if condition

PCI ALS4000 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-19-tiwai@suse.de


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 5bd11527
Loading
Loading
Loading
Loading
+30 −25
Original line number Diff line number Diff line
@@ -832,9 +832,10 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
	}

	/* enable PCI device */
	if ((err = pci_enable_device(pci)) < 0) {
	err = pci_enable_device(pci);
	if (err < 0)
		return err;
	}

	/* check, if we can restrict PCI DMA transfers to 24 bits */
	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(24))) {
		dev_err(&pci->dev, "architecture does not support 24bit PCI busmaster DMA\n");
@@ -842,7 +843,8 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
		return -ENXIO;
	}

	if ((err = pci_request_regions(pci, "ALS4000")) < 0) {
	err = pci_request_regions(pci, "ALS4000");
	if (err < 0) {
		pci_disable_device(pci);
		return err;
	}
@@ -869,7 +871,7 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
	/* disable all legacy ISA stuff */
	snd_als4000_set_addr(acard->iobase, 0, 0, 0, 0);

	if ((err = snd_sbdsp_create(card,
	err = snd_sbdsp_create(card,
			       iobase + ALS4K_IOB_10_ADLIB_ADDR0,
			       pci->irq,
		/* internally registered as IRQF_SHARED in case of ALS4000 SB */
@@ -877,9 +879,9 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
			       -1,
			       -1,
			       SB_HW_ALS4000,
				    &chip)) < 0) {
			       &chip);
	if (err < 0)
		goto out_err;
	}
	acard->chip = chip;

	chip->pci = pci;
@@ -892,11 +894,12 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
	sprintf(card->longname, "%s at 0x%lx, irq %i",
		card->shortname, chip->alt_port, chip->irq);

	if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_ALS4000,
	err = snd_mpu401_uart_new(card, 0, MPU401_HW_ALS4000,
				  iobase + ALS4K_IOB_30_MIDI_DATA,
				  MPU401_INFO_INTEGRATED |
				  MPU401_INFO_IRQ_HOOK,
					-1, &chip->rmidi)) < 0) {
				  -1, &chip->rmidi);
	if (err < 0) {
		dev_err(&pci->dev, "no MPU-401 device at 0x%lx?\n",
				iobase + ALS4K_IOB_30_MIDI_DATA);
		goto out_err;
@@ -907,12 +910,13 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
	 * however there doesn't seem to be an ALSA API for this...
	 * SPECS_PAGE: 21 */

	if ((err = snd_als4000_pcm(chip, 0)) < 0) {
	err = snd_als4000_pcm(chip, 0);
	if (err < 0)
		goto out_err;
	}
	if ((err = snd_sbmixer_new(chip)) < 0) {

	err = snd_sbmixer_new(chip);
	if (err < 0)
		goto out_err;
	}	    

	if (snd_opl3_create(card,
				iobase + ALS4K_IOB_10_ADLIB_ADDR0,
@@ -922,16 +926,17 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
			   iobase + ALS4K_IOB_10_ADLIB_ADDR0,
			   iobase + ALS4K_IOB_12_ADLIB_ADDR2);
	} else {
		if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
		err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
		if (err < 0)
			goto out_err;
	}
	}

	snd_als4000_create_gameport(acard, dev);

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

	pci_set_drvdata(pci, card);
	dev++;
	err = 0;