[PATCH] audio/mixeng: drop some needless checks

marcandre.lureau@redhat.com posted 1 patch 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260224163229.2918858-1-marcandre.lureau@redhat.com
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
audio/audio_template.h | 6 ------
1 file changed, 6 deletions(-)
[PATCH] audio/mixeng: drop some needless checks
Posted by marcandre.lureau@redhat.com 1 month, 2 weeks ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The NULL checks for be, name, callback_fn, and as in
audio_mixeng_backend_open_{in,out} are redundant: the callers
audio_be_open_{in,out} already assert that name, callback_fn, and as
are non-NULL, and dereference be unconditionally via
AUDIO_BACKEND_GET_CLASS(be) before the call.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 audio/audio_template.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/audio/audio_template.h b/audio/audio_template.h
index 228369cf9a1..fe769cde667 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -497,12 +497,6 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) (
     AudioMixengBackendClass *k;
     AudiodevPerDirectionOptions *pdo;
 
-    if (!be || !name || !callback_fn || !as) {
-        audio_bug("backend=%p name=%p callback_fn=%p as=%p",
-                  be, name, callback_fn, as);
-        goto fail;
-    }
-
     k = AUDIO_MIXENG_BACKEND_GET_CLASS(s);
     pdo = glue(audio_get_pdo_, TYPE)(s->dev);
 
-- 
2.53.0


Re: [PATCH] audio/mixeng: drop some needless checks
Posted by Peter Maydell 1 month, 2 weeks ago
On Tue, 24 Feb 2026 at 16:32, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> The NULL checks for be, name, callback_fn, and as in
> audio_mixeng_backend_open_{in,out} are redundant: the callers
> audio_be_open_{in,out} already assert that name, callback_fn, and as
> are non-NULL, and dereference be unconditionally via
> AUDIO_BACKEND_GET_CLASS(be) before the call.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  audio/audio_template.h | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/audio/audio_template.h b/audio/audio_template.h
> index 228369cf9a1..fe769cde667 100644
> --- a/audio/audio_template.h
> +++ b/audio/audio_template.h
> @@ -497,12 +497,6 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) (
>      AudioMixengBackendClass *k;
>      AudiodevPerDirectionOptions *pdo;
>
> -    if (!be || !name || !callback_fn || !as) {
> -        audio_bug("backend=%p name=%p callback_fn=%p as=%p",
> -                  be, name, callback_fn, as);
> -        goto fail;
> -    }
> -

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM