Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp261582lqr; Wed, 5 Jun 2024 05:33:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUe5yA7kuiNugT/9h33QOZ2ixjPEYTYTEG7WGSe6uwokAkC7t8rxMzo4qO/YlyV4u664K7v8kB+WPAsr0VK0RFlt1AIdooaOSET6RLlCg== X-Google-Smtp-Source: AGHT+IGZLF4mh5ZEbnEyBp2hA4vGywWavOnqnORv5atvVhVGcjTjocR3l25CvJcVI4tpAuAckX6H X-Received: by 2002:a50:cd97:0:b0:57a:2537:a730 with SMTP id 4fb4d7f45d1cf-57a8b68754amr1767594a12.4.1717590790228; Wed, 05 Jun 2024 05:33:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717590790; cv=pass; d=google.com; s=arc-20160816; b=YfT5rArbhkAJrMXr1jPx3K2O7V9NsWzXEBmiJ310V1mic0xZVaGCidU+FZN+103BwJ 8VnhuTyo+74SXuOP8NGhIDFV3raQgR4QUpJdf3m1scrI5k5h9rPMBWydIH8HDzji2NwZ 3qrp1ac6IzOb72pF9FPHcKjM7yxAWC/ubtF8foBFO7URG3KRX9SK6mNo0lPtWczyb1ea tJKBQmZVasoHOwvxckjRyRS6ngN2CTlK78MtoEPs/Ew+l3IkF4aXad9MofVsDbNS8/4O cqTfhp3zlEEElssSI3zNo9ElI1Ess6hJbi++Opk907U1hVy/n0p0Jez7D+Y0JeNBcLdg dQlQ== 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=Jf/ugh0nzRPzwjWyrrsPkpczHZeLkF8kCguix+W/uQ4=; fh=HIrbQtQ/dx+3UjCEYGm7dyvjHfgshMi1C9i2ZDYtqW4=; b=IwBypMdDxk+4MAuUQczzZzZlq/pXEM2ggKieLMtUotbi4b5SIsFn78GpQmbP/AclL1 hG0lOvRGKHZSWQgOtuegN/u1hqslfyI/BRAV6wWCchOk4oZlcbcCPsbPpmeWJ9jeau54 gF/Yesg5pjC+paUTQUVRpGyQiEl/3cu/tOuFNePi+3JSfHxPl/I3UelvBUhTUCKnpDhy w2RAWBFuEhliQm8r1pZ0EOy1fE3Y94hyeSdQvohs9aeEZiuGKfZGC+D7kKsTQentayVN 2ww+W3Ht4FQs4cydK8Tq7KoqrJltslaAVp+iBqO8neY+Z+/0LO4KkJlx6pvyXQm76s8c ++gw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KbhnoG26; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202469-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-57a31c67eb4si6310804a12.315.2024.06.05.05.33.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:33:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202469-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=KbhnoG26; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202469-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 E4D251F21918 for ; Wed, 5 Jun 2024 12:33:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D97C1A188A; Wed, 5 Jun 2024 12:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KbhnoG26" 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 6B1431A1863; Wed, 5 Jun 2024 12:02:53 +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=1717588973; cv=none; b=r+aSQwHY+wMjTEQMmo0jUDeBB61LCg29KGNZMkBwO/+RVaeJB7ntiEF0X+7IXeIkFu1E+eRZfg1eELLTP/b5oPQPQNDzu/IUXn/eo5tq+o4dlRp+C2sx7+hwOMQ0f6ClsEcQ16PDp9YhAgsnY5O4ToX2PtuFtY5bjzErG2GDH3g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588973; c=relaxed/simple; bh=CJPoi8rZApWycbxEPaCbZfRjCL3ty4r2D+EZncVONVk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bnKgqHt6cpKU2kXysxKvXpGTFb47CYBAr2cKmWaz0ZOoIZbiF4cyIoLfXfDjBg41Ax9SlZZ2Pa6sKwNlOU9AG229y7UYauKZs53rAGKF2Pwk6B5wSD9bAVBMAao6H5YhX9GMcIE8UwUsjfqqZEA4qpO4Qv31f3tIAnabFJKc+n4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KbhnoG26; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 243C3C32781; Wed, 5 Jun 2024 12:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588973; bh=CJPoi8rZApWycbxEPaCbZfRjCL3ty4r2D+EZncVONVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KbhnoG26xu6D1kpmzIqjkFwXwyp5jOQvJ9uMvbaLc6Kg2GDiuOJUPvPyF3tcxVjws XFwjAUHEdRPXUrQ5TI7L34Wpy+pWtspP+teD4SQ+pI5dxSibo7O6ct/AlI6kMNmn6Z vXu5CLn2BXFE3O0wdcnFgpHzjHn+zwauYtuUzAEbr64XeoSUps3V8+fzEuvACEt7jc kYDTf95uPfp8rvjkaY+/lTcX2Dg5GHRIwR8wiPcN8za2YrcUqODjwUNYzKu35XSmJh ZTLxs1ijWi7TT0BJcFNihr7aApgaoqXLGNFRrb3MfJknWUEO7L1xZNFYRT1ht0Yp2s s+M0dvFgQ0N0Q== 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.9 18/23] ALSA: ump: Set default protocol when not given explicitly Date: Wed, 5 Jun 2024 08:02:01 -0400 Message-ID: <20240605120220.2966127-18-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120220.2966127-1-sashal@kernel.org> References: <20240605120220.2966127-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.9.3 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 fd6a68a542788..65980a2f4982f 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