Re: [RFC PATCH] mailbox: don't free the channel if the startup callback failed

Wolfram Sang
2026-04-07T10:23:46Z

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

> A second thing is that module_put is called. This should also not be
> done when startup() fails. It breaks the expected symmetry that
> request_channel() gets the module and only free_channel() puts it again.

This part is bogus...

> This patch is RFC because I am still somewhat new to the mailbox
> subsystem and might miss something.

... which proves this point ;) ...

> dev_err(dev, "Unable to startup the chan (%d)\n", ret);
> - mbox_free_channel(chan);
> + scoped_guard(spinlock_irqsave, &chan->lock) {
> + chan->cl = NULL;
> + if (chan->txdone_method == TXDONE_BY_ACK)
> + chan->txdone_method = TXDONE_BY_POLL;
> + }

... module_put needs to be here.

Still, not calling shutdown() still seems essential to me, so I'd
appreciate comments about the patch still.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]