Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp264460lqr; Wed, 5 Jun 2024 05:38:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKq0Vfn2Ppm/vEWWL5owe895+RCmuEiER+ACUZwmiutNOUXDvAEWXu3wZp/LT8QxiKpfvPpydKM3RzBXcDMNUQ1ILOGdsjCtov0ycpXQ== X-Google-Smtp-Source: AGHT+IE0MmPT0vnX7FHf8+uhKmgaFeSfsbeF5lSLrezGc0f+91/9XbIlqpV0wI9PiFMQIIzKzuSu X-Received: by 2002:a50:99db:0:b0:572:7bda:1709 with SMTP id 4fb4d7f45d1cf-57a8b69cfeamr1794732a12.9.1717591101623; Wed, 05 Jun 2024 05:38:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591101; cv=pass; d=google.com; s=arc-20160816; b=mjq/YX7Nb3+fWQRm3yCQ3mfUIb6aU2+1GQWHURYU5uE6HE9aBm1JwPz0gqk/bbHheT 24WOXcCQTQ2VnIQSauiPB8NZOxSHN6KoF6Ui7NKY9Vyvx063cAaEd6q0/swVDpcLbeFZ CL7HGk/no8e53gozGuQ/5wrWT3C1tA2HgY2obb/sY1Dk40RzwHMR4eSPwAzNs9zDYise CTCYkQz/bwQUrZKPIZjEWCGfKXK1jdwZx425gi1+AwiI1db6Xu6tnG+BvO6SPIPibnrD Sgu7uYzWjYqR4G/YEn4sfHsf88qn/QcapK3FEfbJCGsal18pPOlFNXrYGrDNWjnRRK07 i2Ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9fMRWG8Hj7NOb71Iy5tUB0MBY3yO84LDjR7atxdD4EQ=; fh=HIrbQtQ/dx+3UjCEYGm7dyvjHfgshMi1C9i2ZDYtqW4=; b=bZRPj8ksRMeiKB8y2kuN2++DnLhLIFnIJg0JWJ4b4v9no+FuVDs2z/6Jn1YOJRUVse 3dbSLW+e5llQxk9DFSLKWL2v8nN0GjQCCel1Bgj+8+OMU0uw66FRYoR292KJ3xqT22AF TtA+4J8l3Rhb7Y9+T1Ll/Spp2KV7XWhRqCxLc4q/8vgEvCCQuFawI0J68zzhYklG8jFd yYyDnO8vrEitFr99TjPFghknXzjUPvVsVlnngHEWqNRxuXVexsMQFCkeSe1zctE7pigb RL5/p34u1eWCcuJ9PmaYnkHaYPgQ6E3yuzPMJ7EuISUuX58K0xH3h97WU8Wq9se4REiw nNVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jQd5zlLv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202489-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202489-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31ba84dfsi6036662a12.168.2024.06.05.05.38.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:38:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202489-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jQd5zlLv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202489-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202489-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 56F691F2216C for ; Wed, 5 Jun 2024 12:38:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD5191C5392; Wed, 5 Jun 2024 12:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jQd5zlLv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0139A1C5380; Wed, 5 Jun 2024 12:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589024; cv=none; b=PDZwVvgV6JVVNuYEJijEUGCejFLk+2wCU4YFxvkMMas81rZVh/9jvQfpAC7n/0O11cB5uXHnGHSwoxGcmukvzt5pHfKw4evqrpANQmBpwx7DDPsRh6yKIbzIlnWotf2bOmsk3S+VpJ+sUgAU8tSXsHHQeLqpDyUp1ke3suZqtYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589024; c=relaxed/simple; bh=qsLzNN4PkdBpxXGX3dj2iINcyEeFq3uwDLAkA5pLkGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fj2cxSR3041QrzNjBIXV4cpIwcKF1MV0PAjF9b7CeuppicflwKRodBb7Qa8YXxOpD7YTzdjWoF9yCksKDDO98BqoQ6UOvQVu9WfVnRVzf3LfFTmmFHiPHUkxnPOrPzJpus3X04tkpWdrYfugRYJZPOmSwEYAcHCBLOqSFBl+Tmc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jQd5zlLv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7881C32786; Wed, 5 Jun 2024 12:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589023; bh=qsLzNN4PkdBpxXGX3dj2iINcyEeFq3uwDLAkA5pLkGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQd5zlLvWs6MLDL/B1w/bheT8zeYyAv6R/C4yWJ5T/r2Nj9O1xMquI4K9lbEVJvxm /aimk6i05ze2dxh6zHZFzvxsYK/IrHHFyfHvBxvHKSaX7dWFD9vxOqGVebGf7Yf7YN DwnYDYHwfbd88Yv3WV4jgzNVWI4EePGQSb9odXpc8DdnL8LBcVlazSdCQEMzgYdVPl 8WX0+mbR45WIg6Cz03/DKS+g3iH8TiAJiAVVjoFiwjd8ka4kzNpkm+L8wWq6BEtQN3 WIiPyAUMXf20xcDNuaO/cRWytbEzSI1595q+6LtUVYx02uAXUGXrErYHD3ICBVvye7 M9ZrA56+STBQg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai , Sasha Levin , 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 Message-ID: <20240605120319.2966627-14-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120319.2966627-1-sashal@kernel.org> References: <20240605120319.2966627-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.12 Content-Transfer-Encoding: 8bit From: Takashi Iwai [ 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 Signed-off-by: Sasha Levin --- 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