Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2894734pxb; Tue, 24 Aug 2021 10:03:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGncMqFcnJxthorihrJrqBfa8O/7e5wYtHI0IvEkWhVlTeC41XVIbxErZN01rwl8+gl2PK X-Received: by 2002:a05:6e02:d03:: with SMTP id g3mr27860703ilj.127.1629824614365; Tue, 24 Aug 2021 10:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824614; cv=none; d=google.com; s=arc-20160816; b=pHsk1IO68UIJCPqYKca93qzPSyzGZzpEMy/ITuPkhyPr6SWnQNomuUss1CRHBJeze+ ypKUaCu4Lu4Q2urCDVlFvaoRLjZpJt5RHDe8SrkOfYIGaOlEPSRbVoQLQplePyUetquj hTo6k0O8O/hLFRU2MwjevuBfqTdIzQHwtBTWBbXOL0hSqLnqKvcs/nQ3cVXcPZr9/SrO sdKEo0Dbh9uTuy94vMRjXZFEqUK8QaH7gVP9InhYAxE+uWFHAWmWHw4D0vUkUdOTcgAC pYrTXJjLxAZ9j0ajtCVQO/GHVhLUa1hxHH+NaLyhjOn8tvb5mHAA+rtpER6fpY0hsYuO IU7w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PXIUGwnb5FqCn+jNRJnliCxZ9mi/uVznj2j5iNy9CRc=; b=bdiOPsYwNRn25C/UP2UFmGnBd/sofCnjQIeRtNPDG/3feAUWaxBb3on208k/JgGdb2 FZkEkvvlXE2CV+FFzwGOXXFLNJi1uApAoM23kgziY2qz9bXQYmXrzqM2EpkvDcxcx5aE rhccB81ZmbKbOlW0ErYOjdTIFz8lsOkdsDKgLzbCP7qO3OYxeJ6EIpW7i5Ro0Fe2khMA EoocVCUiIXDzFXgZzCikz+ZqLeBWxYTEBqabjght2JuVhVL3sjhKOyO5FFPdnMeEK+vr Dzo5vL+J3DG6UTuXv1PkrplYiXa5IaSJLJwS6ovzhh7dEHWRi+zgehF2glz1sIdEjWKt 6Kpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bMk5r9LE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j19si4095369jat.113.2021.08.24.10.03.15; Tue, 24 Aug 2021 10:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bMk5r9LE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238971AbhHXRDQ (ORCPT + 99 others); Tue, 24 Aug 2021 13:03:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:39508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239170AbhHXQ76 (ORCPT ); Tue, 24 Aug 2021 12:59:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2A45613D3; Tue, 24 Aug 2021 16:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824260; bh=f/nt/YUAkJ+rUkUD9W6THvav3I2h0d3zdXs98i6z22w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMk5r9LE2/sON0rAP5t4AmLJOSuqAhZrJjjCoPwpVjnjCgzPHrq2xleMBZY3vJE3h FXD/7pKVBy8no3eO/JhCTic99IfPJ/zIxXupXQjYhAyYYSHeiLUDssCOo9lCvaLT/x c1ggrnshMjNoiOrTo9ZJqUr8NMd0zjURhft+gPFUfoaD2POZJG5Rtc/Ef20DXLaZ+4 OngymX04WcsC9ghjbb9hfyYcvUSXY5KYFR0vmhAYaIUnuO64CiBOI9slecBlpOhqOk SmKcs6SLN7WfXhQjPGMUb9rBfx5M8qvvGzY6CcS3mS/KlMSDPPYrRqP7qQaxTbENH+ NcdxC9jJ5HT2g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jaroslav Kysela , stable@kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.13 093/127] ALSA: hda - fix the 'Capture Switch' value change notifications Date: Tue, 24 Aug 2021 12:55:33 -0400 Message-Id: <20210824165607.709387-94-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jaroslav Kysela [ Upstream commit a2befe9380dd04ee76c871568deca00eedf89134 ] The original code in the cap_put_caller() function does not handle correctly the positive values returned from the passed function for multiple iterations. It means that the change notifications may be lost. Fixes: 352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser") BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213851 Cc: Signed-off-by: Jaroslav Kysela Link: https://lore.kernel.org/r/20210811161441.1325250-1-perex@perex.cz Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_generic.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 1f8018f9ce57..534c0df75172 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -3460,7 +3460,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol, struct hda_gen_spec *spec = codec->spec; const struct hda_input_mux *imux; struct nid_path *path; - int i, adc_idx, err = 0; + int i, adc_idx, ret, err = 0; imux = &spec->input_mux; adc_idx = kcontrol->id.index; @@ -3470,9 +3470,13 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol, if (!path || !path->ctls[type]) continue; kcontrol->private_value = path->ctls[type]; - err = func(kcontrol, ucontrol); - if (err < 0) + ret = func(kcontrol, ucontrol); + if (ret < 0) { + err = ret; break; + } + if (ret > 0) + err = 1; } mutex_unlock(&codec->control_mutex); if (err >= 0 && spec->cap_sync_hook) -- 2.30.2