From patchwork Wed Oct 19 08:35:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265450wrs; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4997PLfkopZLw3qnDEqY4+yoeZiacgp9S+bLcrRpzVgcX7gPGD7DaD/VU5kJr27LkMWPeo X-Received: by 2002:a17:907:c15:b0:78d:af58:4274 with SMTP id ga21-20020a1709070c1500b0078daf584274mr6383026ejc.150.1666178545593; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178545; cv=none; d=google.com; s=arc-20160816; b=kXXdyTxm1o6MR7Rjs31kXNOSFL85QuuT0e2bWPgtbpfA5g8ySQyeeT5bSvz/xYqUsT IE7QJfNYl6kMtAyfSSyQdLfEzvu+/aJOHBvAUGq1Ezj069EJBXx+hoMVvNn0Gt9tSRsd 5ZcjyAU655FNzP7ZHulxYm729ba+PrupCmY7uxdQgA75dv2A2bMH8rabh//BI0macCcc fTFKSZh1GZvJnuwVxvzS8o+Qe9DV0SDTwHdHi3yhR2BJLVCbTU53HoSRyqT9/5z6JedO JycrNIxkyYCDkFLBvGqQQbwieh0Lx2qJoi1hMe83s5sAvXLg+cEYQEO7DmRscodz3DQY JIGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/K/+pAbH0MDotvjlvaXwKwi5KdEBz8R3j8Q+jKXadIQ=; b=JcoMUVm3SZEhJV5lff5WtQaTE86lkbIGS0HJxEJ+PdA9+D6F7psDHvy2QoI7Zk1YBf srwlD1iOxuetTzB1ibjPi3SA4ue0HjiGxwKnNRxeLv8jMABGUxyoZ+CF7S5nWR3m/i2d mrzzVaM8iuPKc490Ei4Qxh4vKvhQy1xIbwiTs5A3CVr0yqjuQVO1b3rI4ospoj+svrDB I4ZP41b/yVyrkpl4Y+qDAWO+VzYEzKI4E76y7gUMQMd2NZfpkkDgkQS163bVxHPbvBtM qRchcJer+ON/7VmDJCYJaBdL20Mmn5rsM1EF6xXjs5IGVASD7hOx4z4+qYvVagGNWCtD Rmhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aVHHN6V7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170906971000b0078307781936si12176493ejx.359.2022.10.19.04.21.54; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aVHHN6V7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbiJSLMD (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbiJSLK6 (ORCPT ); Wed, 19 Oct 2022 07:10:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AC01152C62; Wed, 19 Oct 2022 03:38:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 688B9617F1; Wed, 19 Oct 2022 09:16:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F373C433C1; Wed, 19 Oct 2022 09:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170974; bh=HqzInSWqetlXOUQs1l/ij7Z47hWlE+PPV581CXDV+lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aVHHN6V7wZLEKnWFQfIU2iqN42SqlcZNpNedQss6IGOK0oydAC1Rycndf8uHJ/Kwk uGaMuZY7ogtmrKpK6Pexo+EMldqGsDZoED8klwGc4/TaDq0bftO8uLcG3v3hGmZp4q SByE/ct21GEKNI3VUoWo+hkwMnRXuAG+xdKSz/bc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 6.0 850/862] ALSA: usb-audio: Fix last interface check for registration Date: Wed, 19 Oct 2022 10:35:37 +0200 Message-Id: <20221019083327.413061636@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114834528457132?= X-GMAIL-MSGID: =?utf-8?q?1747114834528457132?= From: Takashi Iwai commit 39efc9c8a973ddff5918191525d1679d0fb368ea upstream. The recent fix in commit 6392dcd1d0c7 ("ALSA: usb-audio: Register card at the last interface") tried to delay the card registration until the last found interface is probed. It assumed that the probe callback gets called for those later interfaces, but it's not always true; as the driver loops over the descriptor and probes the matching ones, it's not separately called via multiple probe calls. This results in the missing card registration, i.e. no sound device. For addressing this problem, replace the check whether the last interface is processed with usb_interface_claimed() instead of the comparison with the probe interface number. Fixes: 6392dcd1d0c7 ("ALSA: usb-audio: Register card at the last interface") Link: https://lore.kernel.org/r/20220915085947.7922-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -884,7 +884,7 @@ static int usb_audio_probe(struct usb_in * one given via option */ if (check_delayed_register_option(chip) == ifnum || - chip->last_iface == ifnum) { + usb_interface_claimed(usb_ifnum_to_if(dev, chip->last_iface))) { err = snd_card_register(chip->card); if (err < 0) goto __error;