Commit 549717fc authored by Takashi Iwai's avatar Takashi Iwai

ALSA: echoaudio: Fix assignment in if condition

PCI echoaudio 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-40-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 164b3dde
...@@ -36,7 +36,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -36,7 +36,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA20)) if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA20))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw: could not initialize DSP comm page\n"); "init_hw: could not initialize DSP comm page\n");
return err; return err;
...@@ -53,7 +54,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -53,7 +54,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->asic_loaded = true; chip->asic_loaded = true;
chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -36,7 +36,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -36,7 +36,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA24)) if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA24))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw: could not initialize DSP comm page\n"); "init_hw: could not initialize DSP comm page\n");
return err; return err;
...@@ -52,7 +53,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -52,7 +53,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL | chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL |
ECHO_CLOCK_BIT_ESYNC; ECHO_CLOCK_BIT_ESYNC;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -49,7 +49,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -49,7 +49,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != ECHO3G)) if (snd_BUG_ON((subdevice_id & 0xfff0) != ECHO3G))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
......
This diff is collapsed.
...@@ -349,7 +349,8 @@ static int load_dsp(struct echoaudio *chip, u16 *code) ...@@ -349,7 +349,8 @@ static int load_dsp(struct echoaudio *chip, u16 *code)
/* If this board requires a resident loader, install it. */ /* If this board requires a resident loader, install it. */
#ifdef DSP_56361 #ifdef DSP_56361
if ((i = install_resident_loader(chip)) < 0) i = install_resident_loader(chip);
if (i < 0)
return i; return i;
#endif #endif
...@@ -495,7 +496,8 @@ static int load_firmware(struct echoaudio *chip) ...@@ -495,7 +496,8 @@ static int load_firmware(struct echoaudio *chip)
/* See if the ASIC is present and working - only if the DSP is already loaded */ /* See if the ASIC is present and working - only if the DSP is already loaded */
if (chip->dsp_code) { if (chip->dsp_code) {
if ((box_type = check_asic_status(chip)) >= 0) box_type = check_asic_status(chip);
if (box_type >= 0)
return box_type; return box_type;
/* ASIC check failed; force the DSP to reload */ /* ASIC check failed; force the DSP to reload */
chip->dsp_code = NULL; chip->dsp_code = NULL;
...@@ -509,7 +511,8 @@ static int load_firmware(struct echoaudio *chip) ...@@ -509,7 +511,8 @@ static int load_firmware(struct echoaudio *chip)
if (err < 0) if (err < 0)
return err; return err;
if ((box_type = load_asic(chip)) < 0) box_type = load_asic(chip);
if (box_type < 0)
return box_type; /* error */ return box_type; /* error */
return box_type; return box_type;
...@@ -667,7 +670,8 @@ static int restore_dsp_rettings(struct echoaudio *chip) ...@@ -667,7 +670,8 @@ static int restore_dsp_rettings(struct echoaudio *chip)
{ {
int i, o, err; int i, o, err;
if ((err = check_asic_status(chip)) < 0) err = check_asic_status(chip);
if (err < 0)
return err; return err;
/* Gina20/Darla20 only. Should be harmless for other cards. */ /* Gina20/Darla20 only. Should be harmless for other cards. */
......
...@@ -194,7 +194,8 @@ static int set_professional_spdif(struct echoaudio *chip, char prof) ...@@ -194,7 +194,8 @@ static int set_professional_spdif(struct echoaudio *chip, char prof)
} }
} }
if ((err = write_control_reg(chip, control_reg, false))) err = write_control_reg(chip, control_reg, false);
if (err)
return err; return err;
chip->professional_spdif = prof; chip->professional_spdif = prof;
dev_dbg(chip->card->dev, "set_professional_spdif to %s\n", dev_dbg(chip->card->dev, "set_professional_spdif to %s\n",
......
...@@ -40,7 +40,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -40,7 +40,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA20)) if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA20))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -58,7 +59,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -58,7 +59,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL | chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL |
ECHO_CLOCK_BIT_SPDIF; ECHO_CLOCK_BIT_SPDIF;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -44,7 +44,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -44,7 +44,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA24)) if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA24))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -74,7 +75,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -74,7 +75,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_CDROM; ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_CDROM;
} }
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -41,7 +41,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -41,7 +41,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO)) if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -56,7 +57,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -56,7 +57,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->asic_loaded = true; chip->asic_loaded = true;
chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -41,7 +41,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -41,7 +41,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_DJ)) if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_DJ))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -56,7 +57,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -56,7 +57,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->asic_loaded = true; chip->asic_loaded = true;
chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -41,7 +41,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -41,7 +41,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_IO)) if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_IO))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -56,7 +57,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -56,7 +57,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->asic_loaded = true; chip->asic_loaded = true;
chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -43,7 +43,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -43,7 +43,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != LAYLA20)) if (snd_BUG_ON((subdevice_id & 0xfff0) != LAYLA20))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -60,7 +61,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -60,7 +61,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->output_clock_types = chip->output_clock_types =
ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_SUPER; ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_SUPER;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -43,7 +43,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -43,7 +43,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != LAYLA24)) if (snd_BUG_ON((subdevice_id & 0xfff0) != LAYLA24))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -62,11 +63,13 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -62,11 +63,13 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |
ECHOCAPS_HAS_DIGITAL_MODE_ADAT; ECHOCAPS_HAS_DIGITAL_MODE_ADAT;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
if ((err = init_line_levels(chip)) < 0) err = init_line_levels(chip);
if (err < 0)
return err; return err;
return err; return err;
......
...@@ -44,7 +44,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -44,7 +44,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != MIA)) if (snd_BUG_ON((subdevice_id & 0xfff0) != MIA))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -62,7 +63,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -62,7 +63,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL | chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL |
ECHO_CLOCK_BIT_SPDIF; ECHO_CLOCK_BIT_SPDIF;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
...@@ -308,8 +308,8 @@ static int snd_echo_midi_create(struct snd_card *card, ...@@ -308,8 +308,8 @@ static int snd_echo_midi_create(struct snd_card *card,
{ {
int err; int err;
if ((err = snd_rawmidi_new(card, card->shortname, 0, 1, 1, err = snd_rawmidi_new(card, card->shortname, 0, 1, 1, &chip->rmidi);
&chip->rmidi)) < 0) if (err < 0)
return err; return err;
strcpy(chip->rmidi->name, card->shortname); strcpy(chip->rmidi->name, card->shortname);
......
...@@ -44,7 +44,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -44,7 +44,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if (snd_BUG_ON((subdevice_id & 0xfff0) != MONA)) if (snd_BUG_ON((subdevice_id & 0xfff0) != MONA))
return -ENODEV; return -ENODEV;
if ((err = init_dsp_comm_page(chip))) { err = init_dsp_comm_page(chip);
if (err) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"init_hw - could not initialize DSP comm page\n"); "init_hw - could not initialize DSP comm page\n");
return err; return err;
...@@ -67,7 +68,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) ...@@ -67,7 +68,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
else else
chip->dsp_code_to_load = FW_MONA_301_DSP; chip->dsp_code_to_load = FW_MONA_301_DSP;
if ((err = load_firmware(chip)) < 0) err = load_firmware(chip);
if (err < 0)
return err; return err;
chip->bad_board = false; chip->bad_board = false;
......
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