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

From: Wolfram Sang

Date: Tue Apr 07 2026 - 06:23:52 EST



> 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: signature.asc
Description: PGP signature