Skip to content

Commit

Permalink
ALSA: rme9652: Use common code in hdsp_get_iobox_version()
Browse files Browse the repository at this point in the history
Add a jump target so that a bit of common code can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
elfring authored and tiwai committed Sep 7, 2017
1 parent 468778a commit 99dcad3
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions sound/pci/rme9652/hdsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,8 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)

hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200 | HDSP_PROGRAM);
hdsp_write (hdsp, HDSP_fifoData, 0);
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) {
hdsp->io_type = Multiface;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
}
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0)
goto set_multi;

hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD);
hdsp_write(hdsp, HDSP_fifoData, 0);
Expand All @@ -810,20 +807,14 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300);
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD);
hdsp_write(hdsp, HDSP_fifoData, 0);
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) {
hdsp->io_type = Multiface;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
}
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0)
goto set_multi;

hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300);
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD);
hdsp_write(hdsp, HDSP_fifoData, 0);
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) {
hdsp->io_type = Multiface;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
}
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0)
goto set_multi;

hdsp->io_type = RPM;
dev_info(hdsp->card->dev, "RPM found\n");
Expand All @@ -838,6 +829,11 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
hdsp->io_type = Digiface;
}
return 0;

set_multi:
hdsp->io_type = Multiface;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
}


Expand Down

0 comments on commit 99dcad3

Please sign in to comment.