public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>, Sasha Levin <sashal@kernel.org>,
	perex@perex.cz, tiwai@suse.com, cujomalainey@chromium.org,
	linux-sound@vger.kernel.org
Subject: [PATCH AUTOSEL 6.8 14/18] ALSA: ump: Set default protocol when not given explicitly
Date: Wed,  5 Jun 2024 08:03:04 -0400	[thread overview]
Message-ID: <20240605120319.2966627-14-sashal@kernel.org> (raw)
In-Reply-To: <20240605120319.2966627-1-sashal@kernel.org>

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit bc42ca002d5d211f9c57334b9b4c25ddb0b4ec35 ]

When an inquiry of the current protocol via UMP Stream Configuration
message fails by some reason, we may leave the current protocol
undefined, which may lead to unexpected behavior.  Better to assume a
valid protocol found in the protocol capability bits instead.

For a device that doesn't support the UMP v1.2 feature, it won't reach
to this code path, and USB MIDI GTB descriptor would be used for
determining the protocol, instead.

Link: https://lore.kernel.org/r/20240529164723.18309-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/core/ump.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/core/ump.c b/sound/core/ump.c
index fe7911498cc43..284d7b73fefd2 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -960,6 +960,14 @@ int snd_ump_parse_endpoint(struct snd_ump_endpoint *ump)
 	if (err < 0)
 		ump_dbg(ump, "Unable to get UMP EP stream config\n");
 
+	/* If no protocol is set by some reason, assume the valid one */
+	if (!(ump->info.protocol & SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK)) {
+		if (ump->info.protocol_caps & SNDRV_UMP_EP_INFO_PROTO_MIDI2)
+			ump->info.protocol |= SNDRV_UMP_EP_INFO_PROTO_MIDI2;
+		else if (ump->info.protocol_caps & SNDRV_UMP_EP_INFO_PROTO_MIDI1)
+			ump->info.protocol |= SNDRV_UMP_EP_INFO_PROTO_MIDI1;
+	}
+
 	/* Query and create blocks from Function Blocks */
 	for (blk = 0; blk < ump->info.num_blocks; blk++) {
 		err = create_block_from_fb_info(ump, blk);
-- 
2.43.0


  parent reply	other threads:[~2024-06-05 12:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 12:02 [PATCH AUTOSEL 6.8 01/18] nvme-multipath: find NUMA path only for online numa-node Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 02/18] dma-mapping: benchmark: avoid needless copy_to_user if benchmark fails Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 03/18] connector: Fix invalid conversion in cn_proc.h Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 04/18] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 05/18] afs: Don't cross .backup mountpoint from backup volume Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 06/18] regmap-i2c: Subtract reg size from max_write Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 07/18] platform/x86: touchscreen_dmi: Add support for setting touchscreen properties from cmdline Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 08/18] platform/x86: touchscreen_dmi: Add info for GlobalSpace SolT IVW 11.6" tablet Sasha Levin
2024-06-05 12:02 ` [PATCH AUTOSEL 6.8 09/18] platform/x86: touchscreen_dmi: Add info for the EZpad 6s Pro Sasha Levin
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 10/18] nvmet: fix a possible leak when destroy a ctrl during qp establishment Sasha Levin
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 11/18] kbuild: fix short log for AS in link-vmlinux.sh Sasha Levin
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 12/18] nfc/nci: Add the inconsistency check between the input data length and count Sasha Levin
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 13/18] spi: cadence: Ensure data lines set to low during dummy-cycle period Sasha Levin
2024-06-05 12:03 ` Sasha Levin [this message]
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 15/18] drm/amdgpu: silence UBSAN warning Sasha Levin
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 16/18] drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent Sasha Levin
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 17/18] Revert "drm/amdkfd: fix gfx_target_version for certain 11.0.3 devices" Sasha Levin
2024-06-05 12:03 ` [PATCH AUTOSEL 6.8 18/18] null_blk: Do not allow runt zone with zone capacity smaller then zone size Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240605120319.2966627-14-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cujomalainey@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox