Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2907589pxb; Tue, 24 Aug 2021 10:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTdQhbi8tUtdoYc9jIXjrJBg964Ns1G15AsJPUMAC1+oRtq9KO4twFTecZRG8vWauQgrM8 X-Received: by 2002:a17:906:4709:: with SMTP id y9mr10017454ejq.10.1629825611259; Tue, 24 Aug 2021 10:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825611; cv=none; d=google.com; s=arc-20160816; b=bAY8i4R6pJ8FG1B8N/QrO6eVZpPiiAhQfoT8nGdwfPsXdr7ca9WS5Puhs5aZ/VDGTy aoEn1NcjbcQavqiPVhEiQx3vOqdUoJrIYvSEFGZxk6n4Nm4oy/vWLFenYyW8DjPPI68/ utCVK4lcWsvzI7H03uwouz2sqA8/tPBT/cJoDjTF/mojLiBXGsyT/lPSwgq2nCuN+Hum xzGJQq5OtXJGvYFjTsJnYeOC0vtkEXB50P7K4ec8BXi7zMn0Xtrhd1FG3w1XNTL79CJ2 XbZrI4tsDe7LihCfnrr/NJoMtwV5hqS59k41NMQZzbpDtrrNJYeSFJiWlRyCXIHL3rlM UIRg== 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=l7L394qg4HanwOK2WWmmawekCa0Pr74fHt7B1myDV4Q=; b=w3k6ypv7gE6cgAXeCs4MqWzrHrrYp5bRE/2VSID8ALQR2m9w7XK1dqGbACijNOm9Bi VWxH9z00gWi2KrLfHU132fSCTdfqzyjbBj5GJ3DKa8E/IANfj0TCwfjt0BtuVQc4QR4y 90LyRJle7mCtuttYzU6TSZMy+Xd31T6CV6Aql15b3HQQIWQJ5AIH4/EB1g1MLYBrPbiR qHW7R16Js0Ij8x1EIvZDY4gR12VXh+Pe5B3bNooXse1tQZ3+tXE6vqcDdwfE6fmFlPlm 50Kc0u+S+1iAPNGoJD93BClEPc1Hip6z96rM3n0PnQov1wLOJ/iZwiojMPQxEswc/k2N MxPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UMxuvrkt; 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 l4si12701004edj.282.2021.08.24.10.19.47; Tue, 24 Aug 2021 10:20:11 -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=UMxuvrkt; 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 S240237AbhHXRSh (ORCPT + 99 others); Tue, 24 Aug 2021 13:18:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:55604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236157AbhHXRQi (ORCPT ); Tue, 24 Aug 2021 13:16:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 424B661AA5; Tue, 24 Aug 2021 17:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824515; bh=5jI/951hIv2NGFsu33huREcWuPtYmbl8Dh83eqTkI4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMxuvrktJisZRBY6GP+gueQkhGIJ51xmGpkOKrfL1weas0h+qN4Y+qProcUgyqcTK ZPCSXMMmrdl+HdwzNC9psx743SffwQD0YZf6H7ImSdiXTnoVIi7zArCOHM1JhQ1OVR F6nSxj0c64r9yXZHQ5MY0PL4EGW3JkND/96qXcha3iPyOZS10nBqEc0WTQKNg10Bcy YWak7blyEF/mq3BVbCTpPbY3GOjCr+szoGcHc9DFleSZWJjSbdIgpBI5FCB7tqIBjU 4jqWOFvSYnUAbAx6UP/rLlB5WLMrBI/ZuyP4cU0MbIbwYewJ140OmJZ0+1COR3D3Fp ZxoH5sEduhGAw== 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.4 47/61] ALSA: hda - fix the 'Capture Switch' value change notifications Date: Tue, 24 Aug 2021 13:00:52 -0400 Message-Id: <20210824170106.710221-48-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170106.710221-1-sashal@kernel.org> References: <20210824170106.710221-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.143-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.143-rc1 X-KernelTest-Deadline: 2021-08-26T17:01+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 7ac3f04ca8c0..e92fcb150e57 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -3458,7 +3458,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; @@ -3468,9 +3468,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