diff mbox series

ALSA: hda/hdmi: Simplify the pcm_idx condition in hdmi_pcm_setup_pin()

Message ID 20220921093322.82609-1-perex@perex.cz (mailing list archive)
State Accepted
Commit 9bf320f0cf872bf23d9f03abefeff2130acbd6c5
Headers show
Series ALSA: hda/hdmi: Simplify the pcm_idx condition in hdmi_pcm_setup_pin() | expand

Commit Message

Jaroslav Kysela Sept. 21, 2022, 9:33 a.m. UTC
Make the code more readable.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 sound/pci/hda/patch_hdmi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Takashi Iwai Sept. 21, 2022, 10:11 a.m. UTC | #1
On Wed, 21 Sep 2022 11:33:22 +0200,
Jaroslav Kysela wrote:
> 
> Make the code more readable.
> 
> Signed-off-by: Jaroslav Kysela <perex@perex.cz>

Thanks, applied.


Takashi
diff mbox series

Patch

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index dc36af2928b7..e20e0ed759f6 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1461,10 +1461,9 @@  static void hdmi_pcm_setup_pin(struct hdmi_spec *spec,
 	int mux_idx;
 	bool non_pcm;
 
-	if (per_pin->pcm_idx >= 0 && per_pin->pcm_idx < spec->pcm_used)
-		pcm = get_pcm_rec(spec, per_pin->pcm_idx);
-	else
+	if (per_pin->pcm_idx < 0 || per_pin->pcm_idx >= spec->pcm_used)
 		return;
+	pcm = get_pcm_rec(spec, per_pin->pcm_idx);
 	if (!pcm->pcm)
 		return;
 	if (!test_bit(per_pin->pcm_idx, &spec->pcm_in_use))