From: Takashi Iwai <tiwai@suse.de>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: tiwai@suse.com, broonie@kernel.org, perex@perex.cz,
amade@asmblr.net, kuninori.morimoto.gx@renesas.com,
linux-sound@vger.kernel.org
Subject: Re: [PATCH v6] ALSA: control: Verify put() result when in debug mode
Date: Tue, 24 Feb 2026 13:09:27 +0100 [thread overview]
Message-ID: <87o6lexs08.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260223144937.524019-1-cezary.rojewski@intel.com>
On Mon, 23 Feb 2026 15:49:37 +0100,
Cezary Rojewski wrote:
>
> The put() operation is expected to return:
> 1) 0 on success if no changes were made
> 2) 1 on success if changes were made
> 3) error code otherwise
>
> Currently 2) is usually ignored when writing control-operations. While
> forcing compliance is not an option right now, make it easier for
> developers to adhere to the expectations and notice problems by logging
> them when CONFIG_SND_CTL_DEBUG is enabled.
>
> Due to large size of struct snd_ctl_elem_value, 'value_buf' is provided
> as a reusable buffer for kctl->put() verification. This prevents
> exhausting the stack when verifying the operation.
>
> From user perspective, patch introduces a new trace/events category
> 'snd_ctl' containing a single 'snd_ctl_put' event type. Log sample:
>
> amixer-1107 [002] ..... 9.553687: snd_ctl_put: success: expected=0, actual=0 for ctl numid=1, iface=MIXER, name='Master Playback Volume', card id=0
> amixer-1108 [003] ..... 9.498897: snd_ctl_put: success: expected=1, actual=1 for ctl numid=1, iface=MIXER, name='Master Playback Volume', card id=0
> amixer-1111 [001] ..... 9.882768: snd_ctl_put: success: expected=1, actual=1 for ctl numid=5, iface=MIXER, name='Loopback Mute', card id=0
> amixer-1114 [002] ..... 9.212184: snd_ctl_put: fail: expected=1, actual=0 for ctl numid=5, iface=MIXER, name='Loopback Mute', card id=0
>
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Looks almost good, just a minor nitpicking:
> --- a/sound/core/init.c
> +++ b/sound/core/init.c
(snip)
> @@ -537,6 +542,9 @@ void snd_card_disconnect(struct snd_card *card)
> synchronize_irq(card->sync_irq);
>
> snd_info_card_disconnect(card);
> +#ifdef CONFIG_SND_CTL_DEBUG
> + kfree(card->value_buf);
> +#endif
> #ifdef CONFIG_SND_DEBUG
> debugfs_remove(card->debugfs_root);
> card->debugfs_root = NULL;
IMO, it's better to be put in snd_card_do_free() which is the place to
release the actual resources.
thanks,
Takashi
next prev parent reply other threads:[~2026-02-24 12:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 14:49 [PATCH v6] ALSA: control: Verify put() result when in debug mode Cezary Rojewski
2026-02-24 12:09 ` Takashi Iwai [this message]
2026-02-24 15:46 ` Cezary Rojewski
2026-02-24 15:59 ` Takashi Iwai
2026-02-24 13:21 ` Jaroslav Kysela
2026-02-24 15:36 ` Cezary Rojewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o6lexs08.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=amade@asmblr.net \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox