[PATCH 2/7] mailbox: Allow #mbox-cells = <0> without specifying a custom xlate

From: Douglas Anderson

Date: Tue Jul 14 2026 - 18:28:37 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>
---

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.55.0.141.g00534a21ce-goog