Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp271425lqr; Wed, 5 Jun 2024 05:52:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVaJBxsqG/XM8OzDlU5bYLCMMy5HAsONivxMmoyzCBapT34G13Qgms6Ss7kXowhF8qHf1RjAcxR+C+IbKZI82u+ksbr7QBcsfu8T5uxHA== X-Google-Smtp-Source: AGHT+IFsJWsHORCD/+vumBA52ncNBhsiYkEQv64dO1+rfNuR0XrbVzh1p8WEIlL7VzPEM5IPwqp9 X-Received: by 2002:a05:6359:45a9:b0:199:58e4:5f1 with SMTP id e5c5f4694b2df-19c6c8fa6c5mr294175855d.25.1717591930617; Wed, 05 Jun 2024 05:52:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591930; cv=pass; d=google.com; s=arc-20160816; b=UjN76l7zm9s1gEIlqOYHNaaFt5v2gug6cQe/sy/cyYKe4uHFN3c4WfWyGcssCO4/7H Hd0nqqQM1uVs5r+nilsAO90TRQzxNP3TPSy0X2biMNTLQdw6bH0mCHKp9oCkUUYRfUeH LY0IneRSpiyAs5Rvmn5jMk0js+/eyV+EMlbbbluJHkuBvAgp1IyYLe6FgOJm00QjC7fj jM+WpNrdEJmI3ckVQFGAxixEJwATgvEaXiJCI4yjY5HRj7xnDFwG8z99LBx6Hw5IJbap YpDksXFDiNXYY1/cxOLOZureJ4453knzddETBq4OApRpbzmWE9nuRRfl4NSgpA7tbGqr JzJg== 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=chbASULAyIzr/UC2nV6EiReyBWi+Mg9vIfhCw9SWVjUMBG2WrmZEr5zq9G2sOjUuup 78hEj1LukHPO80+VoE4gvFLoNAyIAzFcVnNkDAdFJOFC3kPnmO/ILP5EN0dGH5W2w5H9 uhAK56C5jb+E5lm1r19u5dipRRDIMxKep9JOBmuxOJz0Fuvwgk5YeIvv1MCE855WKD7Z rLSDXRh88J2/X6HmSqAjxtXP8mifpD71fjgdDD178CDePxMhonYU3P6jwltxaN2Y6xid jIs8NgXT//yGjYr3AqGpQIdVnLpAHSwuzJi5YTjIZsMIi5U63YkUvctiS2KlVksvTmDg 6gpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mFOBUBpq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202508-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540fb3e1si10107980a12.163.2024.06.05.05.52.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mFOBUBpq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202508-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F1AD028ACBB for ; Wed, 5 Jun 2024 12:43:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 406F41C95DB; Wed, 5 Jun 2024 12:04:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mFOBUBpq" 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 66D3A1C95C7; Wed, 5 Jun 2024 12:04:33 +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=1717589073; cv=none; b=ry9Q7v3WdRRvJJjBM2J0jIgsVCQtZf8WDu+h3nml9TwFWUvgVJxG8I36CEKYt+itoWnNAOMX9HcBsMLh7hn+U6S0mWG35VlFxKX/MppYmM9hHYFlp7j7zqA9ThWWOk4jKh21F6HdQh639bm7Ku3Yt0q70XFkt+Q5Y17aODN4vUg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589073; c=relaxed/simple; bh=qsLzNN4PkdBpxXGX3dj2iINcyEeFq3uwDLAkA5pLkGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CMPZQ/LDArunqYsS5ljpFOwt1TEE/f8tYhi105VK/6Xl/ygvq6KiJimQbdwEL5z1d2qRlU5rJN1Q1kEZJJ76R30wa3aXbXUOu+Mt++Tt0JS3DPPCUAC4+EEli5B6JiZUdoqLwyUukbd5SBCyHRBZCMZU+eg51Azzi73YyTF7yJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mFOBUBpq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 060E6C3277B; Wed, 5 Jun 2024 12:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589072; bh=qsLzNN4PkdBpxXGX3dj2iINcyEeFq3uwDLAkA5pLkGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFOBUBpqXhIj8cEiFehV7PICbgJLur/GFONTSQw7dEGfexmfHU/sRosSKtVE/sRnA A2OGePl4wEXdILNha2Lnyj8dDB2TiROPI7H41NaM76vyVGF4wa/3eeibIOawfxVUOM 8hEQdGEyiZEifDQ/hlqQlycoFg0Ip7lv1uJAFVUuiajK21Iimihmw8c2mNDc5INjnf SnWUXbLZPSwHu4hg9patc5qFzacj3M3V0OkfsS3ZChpvHOBF9foJFzAuJmCOL4kBC/ 8ilz+05M6/YuNIu39WiCo7P1PfVH11YzF/ePxCl3CWIwb1wkFJUX8Ko4Nw+Cu+leg0 wW1ET6vxsyBmQ== 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.6 14/18] ALSA: ump: Set default protocol when not given explicitly Date: Wed, 5 Jun 2024 08:03:53 -0400 Message-ID: <20240605120409.2967044-14-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120409.2967044-1-sashal@kernel.org> References: <20240605120409.2967044-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.6.32 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