[PATCH v2 1/4] mailbox: Allow #mbox-cells = <0> without specifying a custom xlate
From: Douglas Anderson
Date: Fri Oct 23 2026 - 19:56:29 EST
If a mailbox is only providing one channel, there is no reason to
require any extra mbox-cells. Allow specifying 0.
Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
---
(no changes since v1)
drivers/mailbox/mailbox.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index efacd24a085d..6c9d426f4e58 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -524,7 +524,13 @@ EXPORT_SYMBOL_GPL(mbox_free_channel);
static struct mbox_chan *fw_mbox_index_xlate(struct mbox_controller *mbox,
const struct fwnode_reference_args *sp)
{
- if (sp->nargs < 1 || sp->args[0] >= mbox->num_chans)
+ if (!sp->nargs) {
+ if (mbox->num_chans == 1)
+ return &mbox->chans[0];
+ return ERR_PTR(-EINVAL);
+ }
+
+ if (sp->args[0] >= mbox->num_chans)
return ERR_PTR(-EINVAL);
return &mbox->chans[sp->args[0]];
--
2.56.0.257.gf7497c7d27-goog