On Tue, 24 Feb 2026 at 11:12, Marc-André Lureau <[email protected]> wrote: > > Hi > > On Tue, Feb 24, 2026 at 11:30 AM Peter Maydell <[email protected]> > wrote: > > > > On Mon, 23 Feb 2026 at 13:51, <[email protected]> wrote: > > > > > > From: Marc-André Lureau <[email protected]> > > > @@ -498,9 +498,9 @@ static SW *glue(audio_mixeng_backend_open_, TYPE) ( > > > AudioMixengBackendClass *k; > > > AudiodevPerDirectionOptions *pdo; > > > > > > - if (audio_bug(__func__, !be || !name || !callback_fn || !as)) { > > > - dolog("backend=%p name=%p callback_fn=%p as=%p\n", > > > - be, name, callback_fn, as); > > > + if (!be || !name || !callback_fn || !as) { > > > + audio_bug("backend=%p name=%p callback_fn=%p as=%p", > > > + be, name, callback_fn, as); > > > goto fail; > > > } > > > > In this error-exit check, we will go to the "fail" label if be is NULL. > > But the code at 'fail:' does: > > > > glue(audio_be_close_, TYPE)(be, sw); > > > > and those functions will crash if passed a NULL AudioBackend pointer. > > > > Presumably we should simply return in the be == NULL case ? > > I think so. abort() may be an option too imho
If it's a "can't happen unless programming bug" case, than maybe "assert(be)". Am I right in reading the code that we only call this function from audio_be_open_in() and audio_be_open_out() ? Those two callsites already assert() that name, callback_fn and as are all non-NULL. So perhaps we should assert(be) there also, and drop this if(...) check in this function entirely as redundant ? > Do you want me to send a patch? Yes, please. thanks -- PMM
