Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2902214pxb; Tue, 24 Aug 2021 10:12:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVkMWUJhppdugFuAuIbz6u207n1Onug5n+dy1e2uXYGVEomDj5YPcaaSvoOhgqz37rLUlG X-Received: by 2002:a02:84c2:: with SMTP id f60mr35013557jai.133.1629825178131; Tue, 24 Aug 2021 10:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825178; cv=none; d=google.com; s=arc-20160816; b=ZhuDIeXPJ0xk5Y+lIIwy0j7QNZwM3f+iF1x9CDQFWCCPAM+BfPJKbqvVDvtMmaEgSi 4BW8VxcdrplQsSm6lMNxBxIznjCXkwCRHiLkugP0d2NwOiEb05fsQxfMZ3lMpRwBYRDZ Q4IcXADBgBwXJwUu8doLN2YTd4XT/kjUDt1ne/fA047XO91uS3+813XsmXpNHUpyP7a7 5VECgiYa3Sa0HKoGcym3szBfq/Xbn02ZCZFV6gllEGeTkNNxQIy7cAzRH4riN0fPlBcN qUEN959ZiB20l+7BDajay8hky4r8jQXB9cSZEZrRmtGK8y32hPn9CsgosbZMSc1nlzcB B+tQ== 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=BlSjGv6eBeWuNDeZWjpCkPTBCF7lRYcOutTxsD7wFzw=; b=U6MGNBJkLaM91tEclfd5qOsF1b1qBCXWdRnmD14RCZsY+r2kftzAd2SQWxuBkpKbNQ nHzTgM31OWviHIzbWyhKIvdXz1B24mICROlGdIRMPy9LFsF72wLQmaSk/v0UJhUp6GOy cLLLC+nZwKCEsp5S41t7uByLB50dw+Jnz17QiSQczf0j0AZgOjOxBo5wVPxABqoWIo9g f5h8kGIACKpOlbaCqetKKBKuBLiJkeLv4XU1ztQKSmIZsYVhTqIfBtCnQhlWrvG+z++i HcKg7zX8Qf2WqXN5HXqKc75Om8ZRT4tKzc4O/6/puuqkNKJc/ZNmrii7W4+h08wuLKUx HsOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SR0Iz6fS; 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 i7si17549252ilk.127.2021.08.24.10.12.46; Tue, 24 Aug 2021 10:12:58 -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=SR0Iz6fS; 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 S239378AbhHXRMn (ORCPT + 99 others); Tue, 24 Aug 2021 13:12:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:51262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240011AbhHXRJw (ORCPT ); Tue, 24 Aug 2021 13:09:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2EDDD6142A; Tue, 24 Aug 2021 17:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824427; bh=HGt3xYO6SY2tz5FxJK7avyFjnxvj1Bb4HFWIqBMBrOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SR0Iz6fSBhFU1cICPukLCs8lbIAH1STgIJYkif6AbHVQHCl7V1mO03t5nmIWYBfvF 21nrB2xzcFZmb4KtfsNg/bwZIUV+eXEUzKh/xr+r0pg0D9qUKFiwO8v6TeSwNA+PE8 84b0PEN2UICXGHmKU0IUNKFiOzNm1VeoVoZUpKr60E/WjBaxME1pQulGCl6o3Z5p/b kn1vyT3e9mMkxHzrk1gP43RvFoE5TT8QhSF0HCStFQUssgXBiOfjBv4e4ApV82+GwK 0ldZf3O9PIpF7hi4X9q9a0oTcUN6QeXJwBmU4x14uRZsozNZpdg8jXTxLgdLoxXPE8 KVw4fBvTO+HNA== 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.10 78/98] ALSA: hda - fix the 'Capture Switch' value change notifications Date: Tue, 24 Aug 2021 12:58:48 -0400 Message-Id: <20210824165908.709932-79-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165908.709932-1-sashal@kernel.org> References: <20210824165908.709932-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.61-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.61-rc1 X-KernelTest-Deadline: 2021-08-26T16:58+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 7c49a7e92dd2..323df011b94a 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