From patchwork Wed Aug 12 20:14:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Scheel X-Patchwork-Id: 7003811 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0B8609F358 for ; Wed, 12 Aug 2015 20:15:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A8EE20612 for ; Wed, 12 Aug 2015 20:15:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3622520699 for ; Wed, 12 Aug 2015 20:15:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 32CB82614F4; Wed, 12 Aug 2015 22:15:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B83352608ED; Wed, 12 Aug 2015 22:15:19 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id BF2AF2612AD; Wed, 12 Aug 2015 22:15:18 +0200 (CEST) Received: from sender163-mail.zoho.com (sender163-mail.zoho.com [74.201.84.163]) by alsa0.perex.cz (Postfix) with ESMTP id 2F2D1260462 for ; Wed, 12 Aug 2015 22:15:11 +0200 (CEST) Received: from juli-workstation.net.jusst.de. (x2f05259.dyn.telefonica.de [2.240.82.89]) by mx.zohomail.com with SMTPS id 1439410508870104.56811656923855; Wed, 12 Aug 2015 13:15:08 -0700 (PDT) From: Julian Scheel To: alsa-devel@alsa-project.org, tiwai@suse.de Date: Wed, 12 Aug 2015 22:14:59 +0200 Message-Id: <1439410499-28630-1-git-send-email-julian@jusst.de> X-Mailer: git-send-email 2.5.0 X-ZohoMail: Ss SS_10 UW UB CHF_INT_SMD_EXT SGR4_1_17065_0 X-ZohoMail-Owner: <1439410499-28630-1-git-send-email-julian@jusst.de>+zmo_0_ X-ZohoMail-Sender: 2.240.82.89 X-Zoho-Virus-Status: 2 Cc: Julian Scheel Subject: [alsa-devel] [PATCH] ALSA: usb-audio: Recurse before saving terminal properties X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP When the descriptor parser recurses into the clock source descriptor, the terminals properties, like name and type, are set to the values of the clock selector as check_input_term overwrites term->name and others in the recursive call. As we want to only fill missing values using the descriptors higher in the recursion tree the properties taken from the actual descriptor must be applied after recursing. Signed-off-by: Julian Scheel --- sound/usb/mixer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 6b3acba..4a49944 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -715,15 +715,16 @@ static int check_input_term(struct mixer_build *state, int id, term->name = d->iTerminal; } else { /* UAC_VERSION_2 */ struct uac2_input_terminal_descriptor *d = p1; - term->type = le16_to_cpu(d->wTerminalType); - term->channels = d->bNrChannels; - term->chconfig = le32_to_cpu(d->bmChannelConfig); - term->name = d->iTerminal; /* call recursively to get the clock selectors */ err = check_input_term(state, d->bCSourceID, term); if (err < 0) return err; + + term->type = le16_to_cpu(d->wTerminalType); + term->channels = d->bNrChannels; + term->chconfig = le32_to_cpu(d->bmChannelConfig); + term->name = d->iTerminal; } return 0; case UAC_FEATURE_UNIT: {