Skip to contentSkip to conversation

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

PATCH Applied Jaroslav Kysela 2 participants 2 messages Sep 21, 2022 Sound

lore
Share & tools
lore

Jaroslav Kysela

author maintainer
#0 lore raw

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

Make the code more readable.

---
 sound/pci/hda/patch_hdmi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
sound/pci/hda/patch_hdmi.c +2 -3
index dc36af2928b7..e20e0ed759f6 100644
@@ -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))
Signature · 1 line
2.35.3