From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796323618; b=ah4CreS+QVbCGLSM1OYy20Ciu7h6iagMCpl7c+kulav74VrnJ8ZzAtzdd8JWS18mINQC wTTnGxTFpWtBKzZaSvkR9bzwNM8QU96PrXO1fr0SxuD2VPFkVNkjAS0lVzewc1ddqCT9o DLeTzZcQdj3NOIrS95Zm2bKg1QJbxk2DpffgAxUn+LAbDgxcmNYOPhvW4aQ51kN73x3cJ sWVkI4rhrv8JtyuvYcLBsSmwYUWuB0trg89lcSBfE8GM75EBfJPK6UZVrMJlTIePH40w0 19XfJ+/mfIiqIx3aK7cDE1yPOevn2/6iwQiE34ZBqXo2+ckA4aUueX52MAgA27ft9ng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796323618; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=aPa6pHo7AcsNDzUvJ8c8yE8/c5wsLmHWNb9XDW648Bo=; b=nhN7Ggo0tZs2dmQHFDl0T/0N1tKlMe+lKBSqOddhSE+Uy2jwjCPVIkq4KPPPv8EA6JYC 0x4hpCzgwqIJX4J6jncgY2NXSJpmtu/4pj+Z/xvd9c9lz7UP/rEA5soaKai3bk9phKrlt 1H/R5EIj0tWVHTY4QKHVo0VXYnSxDnQ6t/zVCbuBU35XF6p6c07wCO8nspdkCvEp3stKy zaoL/dYs8BGotR70Wfa5QHWF8EPtqHQVEVUiorUor9G5LNWuioNlDQVhohFZsXY1NSlDj ZRmz+IjwlgMZi3Q2WTRVBNP3eCaLAh5661rK4GcNljrMOWX1piLHDVyRzvW1Ry+zzbQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D65TxcR4; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ED9E606A322 for ; Thu, 3 Dec 2026 18:46:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D65TxcR4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB01E1F000C1; Thu, 3 Dec 2026 18:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796323618; bh=aPa6pHo7AcsNDzUvJ8c8yE8/c5wsLmHWNb9XDW648Bo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=D65TxcR4sddSkGnw4EVZ6Z8pRNBsZHUXRSCc6kbIUYYEbcTTZMoFZorgCK/m4Y6Kh FzNjAgwSGRI1jEN+TUZdhIuLNRcQc5kr4fySkN9gwq9kieUzavNLibWMrRqrCjNXxn FGWOl0SMlqiWwam9+t90RzSh/Bx4obCeycrpwOuKy7PxPdz6K2MotC6/zo56lmB8oP Ix4VYSHzyVFXnYhgfLqa0mkB9bRVTKnPE2n323uTQyc+d4DedCMAGlJu0GbBx8W7c4 Ez6yKTMC3n3504USY+Y6RSqnjqE9WTyn6Kehm6CtwixZaem/QsKlKkGyJXb46U4h3m umIJFJuYARwZw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 3/3] ASoC: codecs: hdac_hdmi: Update codec read API callers Reply-To: sashiko-reviews@lists.linux.dev To: "Sreeraj S Kurup" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261203170741.3873-4-sreekuttan2156239@gmail.com> References: <20261203170741.3873-1-sreekuttan2156239@gmail.com> <20261203170741.3873-4-sreekuttan2156239@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 18:46:57 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 7 potential issues to consider: - [High] ALSA: hda: snd_hdac_check_power_state() still calls codec_read() with 5 args - [High] ALSA: hda: hda_codec.h wrappers still call snd_hdac_codec_read() with 5 args - [High] ALSA: hda: hdmi_set_channel_count() local current collides with kernel macro - [Medium] ALSA: hda: snd_hdac_sync_power_state() returns uninitialized or stale state - [Medium] ALSA: hda: non-atomic snd_hdac_codec_read() change breaks bisect and dup API - [Medium] ASoC: hdac_hdmi: early break defeats retry loop in hdac_hdmi_set_power_state() - [Medium] ASoC: hdac_hdmi: aborting hdac_hdmi_runtime_suspend() on D3 read error -- commit c39e00c18989bfbf7ab831cd560cf2b65326aa27 Author: Sreeraj S Kurup ASoC: codecs: hdac_hdmi: Update codec read API callers This commit updates the snd_hdac_codec_read() callers in hdac_hdmi.c to pass an output pointer for the codec response and check the returned error status. > diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c > index f7922ffaad973..8dad9f1644f89 100644 > --- a/sound/soc/codecs/hdac_hdmi.c > +++ b/sound/soc/codecs/hdac_hdmi.c > @@ -241,8 +241,15 @@ static int hdac_hdmi_get_port_len(struct hdac_device= *hdev, hda_nid_t nid) > static int hdac_hdmi_port_select_get(struct hdac_device *hdev, > struct hdac_hdmi_port *port) > { > - return snd_hdac_codec_read(hdev, port->pin->nid, > - 0, AC_VERB_GET_DEVICE_SEL, 0); > + unsigned int res; > + int err; > + > + err =3D snd_hdac_codec_read(hdev, port->pin->nid, > + 0, AC_VERB_GET_DEVICE_SEL, 0, &res); > + if (err < 0) > + return err; > + > + return res; > } [Severity: Medium] Does splitting the snd_hdac_codec_read() signature change across commits break git bisect? Commit "ALSA: hda: core: Fix command creation error handling" changed the exported prototype without updating callers in sound/hda/core/hdmi_chmap.c and sound/soc/codecs/hdac_hdmi.c in the same commit, so the intermediate commits fail to build. Also, every updated call site passes 0 for flags, which the existing snd_hdac_read() already provides with the same status-return and output parameter interface. Switching these callers to snd_hdac_read() would avoid changing snd_hdac_codec_read() at all. [Severity: High] Were the inline wrappers in include/sound/hda_codec.h missed when updating snd_hdac_codec_read()? Both snd_hda_codec_read() and snd_hda_codec_write_sync() still call snd_hdac_codec_read() with five arguments, breaking the build for every translation unit that includes include/sound/hda_codec.h. Note that snd_hda_codec_read() callers expect the 32-bit response (or -1 on error) as the return value rather than the 0/negative status. [Severity: High] Does the local variable named current in hdmi_set_channel_count() break compilation of sound/hda/core/hdmi_chmap.c? Commit "ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers" added: sound/hda/core/hdmi_chmap.c:hdmi_set_channel_count() { int current; current =3D hdmi_get_channel_count(codec, cvt_nid); ... } Because the included headers pull in asm/current.h, the global current macro expands over the declaration and assignment, causing a syntax error whenever CONFIG_SND_HDA_CORE is enabled. [ ... ] > @@ -740,15 +752,18 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(stru= ct hdac_device *hdev, > static void hdac_hdmi_set_power_state(struct hdac_device *hdev, > hda_nid_t nid, unsigned int pwr_state) > { > - int count; > - unsigned int state; > + int count, err; > + unsigned int state, res; > =20 > if (snd_hdac_get_wcaps(hdev, nid) & AC_WCAP_POWER) { > if (!snd_hdac_check_power_state(hdev, nid, pwr_state)) { [Severity: High] Does snd_hdac_check_power_state() still call codec_read() with five arguments? After commit "ALSA: hda: core: Fix command creation error handling" added the output parameter to codec_read(), sound/hda/core/device.c fails to compile: sound/hda/core/device.c:snd_hdac_check_power_state() { unsigned int state =3D codec_read(hdac, nid, 0, AC_VERB_GET_POWER_STATE, 0); ... } It also needs to pass &state and treat a negative error return the same way AC_PWRST_ERROR was handled previously. > for (count =3D 0; count < 10; count++) { > - snd_hdac_codec_read(hdev, nid, 0, > + err =3D snd_hdac_codec_read(hdev, nid, 0, > AC_VERB_SET_POWER_STATE, > - pwr_state); > + pwr_state, &res); > + if (err < 0) > + break; [Severity: Medium] Does breaking out of the loop on err < 0 defeat the 10-attempt retry logic here? Previously, a transient HDA verb or RIRB error continued into snd_hdac_sync_power_state() and retried; now the first error aborts immediately without logging or reporting failure. Because hdac_hdmi_set_power_state() returns void, callers such as hdac_hdmi_pin_output_widget_event() proceed to configure a pin or converter widget that may still be in D3, leaving audio silent. > =20 > state =3D snd_hdac_sync_power_state(hdev, > nid, pwr_state); > if (!(state & AC_PWRST_ERROR)) > break; [Severity: Medium] Can snd_hdac_sync_power_state() return an uninitialized or stale state when snd_hdac_codec_read() fails? In sound/hda/core/device.c, state is uninitialized on entry and is not set to AC_PWRST_ERROR before breaking out on error: sound/hda/core/device.c:snd_hdac_sync_power_state() { unsigned int state, actual_state, count; for (count =3D 0; count < 500; count++) { if (snd_hdac_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0, &state)) { msleep(20); break; } ... } If codec_read() fails early (for example, snd_hdac_make_cmd() returning -EINVAL or a runtime PM error in call_exec_verb()) without writing *res, state holds stack garbage or a previous poll value without AC_PWRST_ERROR set, causing callers to abort retries early. Assigning state =3D AC_PWRST_ERROR before breaking restores the previous contract. [ ... ] > @@ -1942,6 +1959,8 @@ static int hdac_hdmi_runtime_suspend(struct device = *dev) [ ... ] > * is received. So setting power state is ensured without using loop > * to read the state. > */ > - snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE, > - AC_PWRST_D3); > + ret =3D snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE, > + AC_PWRST_D3, &res); > + if (ret < 0) > + return ret; [Severity: Medium] Can returning early on a D3 verb error wedge runtime PM and abort system suspend? If snd_hdac_codec_read() returns -EIO (such as on an RIRB timeout), rpm_suspend() sets dev->power.runtime_error =3D -EIO because it is neither -EAGAIN nor -EBUSY, and nothing in this driver clears it. Once runtime_error is set, later HDMI PCM opens fail with -EINVAL in snd_soc_pcm_component_pm_runtime_get(), the skipped link and display power teardown keeps the controller and display power well awake (and leaks hlink->ref_count on unbind), and pm_runtime_force_suspend() aborts system sleep. Logging the error and continuing with the teardown before returning 0 would preserve the previous behavior. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203170741.3873= -1-sreekuttan2156239@gmail.com?part=3D3