Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sreeraj S Kurup" <sreekuttan2156239@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] aoa: Fix codec unregister handling
Date: Sat, 28 Nov 2026 08:17:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-238537@kernel.org> (raw)
In-Reply-To: <20261128081025.2878-1-sreekuttan2156239@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] ALSA: aoa: aoa_codec_unregister() duplicates
  aoa_fabric_unlink_codec()
- [Low] ALSA: aoa: missing Fixes: trailer in commit message
--

commit b926c8dbc73cbd6442745a299e6053651d3d611b
Author: Sreeraj S Kurup <sreekuttan2156239@gmail.com>

> aoa: Fix codec unregister handling
>
> Fix aoa_codec_unregister() to use the codec's own fabric pointer
> when removing a codec.
>
> Previously, the function checked the global fabric pointer instead
> of codec->fabric. This could call the fabric's remove_codec()
> callback for a codec that was never attached to the fabric.
>
> The function also called module_put() unconditionally, even when
> no module reference had been acquired by attach_codec_to_fabric().
> This could cause an incorrect module reference count.
>
> Save codec->fabric before unregistering the codec, and call
> exit(), remove_codec(), and module_put() only when the codec is
> actually attached to a fabric.
>
> This also prevents releasing the module reference a second time
> when codec initialization has already failed and the attach path
> has cleaned up.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>

[Severity: Low]
Since this fixes a bug introduced when snd-aoa was added, should it include:

  Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")

> diff --git a/sound/aoa/core/core.c b/sound/aoa/core/core.c
> index 99b032a4081fd..41a3b79ca93a2 100644
> --- a/sound/aoa/core/core.c
> +++ b/sound/aoa/core/core.c
> @@ -71,13 +71,18 @@ EXPORT_SYMBOL_GPL(aoa_codec_register);
>  
>  void aoa_codec_unregister(struct aoa_codec *codec)
>  {
> +	struct aoa_fabric *codec_fabric = codec->fabric;
> +
>  	list_del(&codec->list);
> -	if (codec->fabric && codec->exit)
> -		codec->exit(codec);
> -	if (fabric && fabric->remove_codec)
> -		fabric->remove_codec(codec);
> -	codec->fabric = NULL;
> -	module_put(codec->owner);
> +	if (codec_fabric) {
> +		if (codec->exit)
> +			codec->exit(codec);
> +		if (codec_fabric->remove_codec)
> +			codec_fabric->remove_codec(codec);
> +
> +		codec->fabric = NULL;
> +		module_put(codec->owner);
> +	}
>  }
>  EXPORT_SYMBOL_GPL(aoa_codec_unregister);

[Severity: Low]
This isn't a bug, but could this call aoa_fabric_unlink_codec(codec) when
codec->fabric is set, the same way aoa_fabric_unregister() does, instead of
duplicating the detach sequence?

sound/aoa/core/core.c:aoa_fabric_unlink_codec() {
    ...
	if (codec->exit)
		codec->exit(codec);
	if (codec->fabric->remove_codec)
		codec->fabric->remove_codec(codec);
	codec->fabric = NULL;
	module_put(codec->owner);
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128081025.2878-1-sreekuttan2156239@gmail.com?part=1

  reply	other threads:[~2026-11-28  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  8:10 [PATCH] aoa: Fix codec unregister handling Sreeraj S Kurup
2026-11-28  8:17 ` sashiko-bot [this message]
2026-11-28  8:52 ` [PATCH v2] ALSA: " Sreeraj S Kurup

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=sashiko-outbox-238537@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sreekuttan2156239@gmail.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