Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2923642pxb; Tue, 24 Aug 2021 10:42:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5zWRLcXxc5+NL2N4C/a8t9s5jhvnwJVkZZIvuxovR8Cb38v+Qlw01MgLxpmzl1FGOLm9v X-Received: by 2002:a5e:9602:: with SMTP id a2mr32969682ioq.146.1629826931149; Tue, 24 Aug 2021 10:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826931; cv=none; d=google.com; s=arc-20160816; b=pOE35yF8Gjnp5a5d70ps/Fjl1KbGuLt66e1ZP7+Z41QenIHMPHK0PEC+tYj7U549h6 hzwcckzGrlTouo+loWM5uUfGP+UUSlBhwoB8t7SpV5nIuwu3juz1pQwj2yTjH7yG0lKB IEPzUSzP7ih5xYftIcWIObCf8SMz9Ykxsk8RIQBp2EzJa+ZB4rHepbaUzqy7+2bihKLV IkTvf86OOCRHF48+WXuS66BgblQsOCzSiY/nRwRyYKCF8rKlT5mnW0QLUDnYizbAyRbQ qAMsi7JzwNK4mA0DssNSsPh6oqlCyG68su9/E7foyVg1NVmoiU5+m15wN2H2K/pAbLe/ 4ybA== 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=h1Ouae6GVy5ZWHei8CGAmJAMZvACsHv+nvtYT2SZoOI=; b=bBs9dEqdmQX6tgDAOfXJh+x3XDL5CgrT4e3NCLkwv4BTee+FNtEnPTwR0oK+j0CNaf IWkOgxjkjgSHoUKS9VJNK3QOw9ZhlfmBuJ8oYaQINHoFfgk8vsWv4/xM4eWWWGHOFVjJ SnPZngdJEToc2uN8A99Bb+xMGCufwGIEZFNMvyCGVWU7xbYaynHypOwVzihlmekk6eQU Yt59p6VIQF1FKUgFn1NE4569VSQ4yUY5CC98bQdp+j2GKe4pmzU5lWOWgqk0IbTV+CH3 5QIcr5WyjA3eZTjXctOjEXg3ciq75p2jH+gHu/YyQlbeaEMYYL+oNVqYxz9kykxnXP0d NF1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qOfAMkzY; 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 e28si8753169iov.1.2021.08.24.10.41.59; Tue, 24 Aug 2021 10:42: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=qOfAMkzY; 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 S242064AbhHXRmA (ORCPT + 99 others); Tue, 24 Aug 2021 13:42:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:45841 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242124AbhHXRjK (ORCPT ); Tue, 24 Aug 2021 13:39:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F050B61C15; Tue, 24 Aug 2021 17:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824891; bh=24ITMfCAdcsFGlnYRCGUGFfrp81ofTe/nmFJezF0Hw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qOfAMkzYGzLrDFRtzmZzuP3RTDx7vhWL2ynroR4CJLhtMN+h3ZeNUpWxMsB7O3gF+ PCESHIJk7bCet44VUmdcecW/k74JkkNkhVltBGrEDrXV4Kx3s9bci7ZDAiAaiq6YjB ceF6plkW/gqpe65u63cwSDsB2+GPnzZkV4JqDVcg9uBqyWR/xp5goPf+M3OeEQiIZX Sy7p9c2Fa0FbBnIsW6LIZwo4zd07BnWxhou+tTqXzdKM3c5wX0FRU/37bGiYd8he8U gihawDlz2IydncreSNkTy6ZEKyB23bW4OecCl4l0i1obBW3sCKliVT5FRRL5ZKUQ9N ELo/Epcaq6FVg== 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 4.4 28/31] ALSA: hda - fix the 'Capture Switch' value change notifications Date: Tue, 24 Aug 2021 13:07:40 -0400 Message-Id: <20210824170743.710957-29-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170743.710957-1-sashal@kernel.org> References: <20210824170743.710957-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.282-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.282-rc1 X-KernelTest-Deadline: 2021-08-26T17:07+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 7fed8d1bb79c..5c708d9851b8 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -3442,7 +3442,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; @@ -3452,9 +3452,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