2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

mailbox: use error ret code of of_parse_phandle_with_args()

In case of error, of_parse_phandle_with_args() returns -EINVAL when the
passed index is negative, or -ENOENT when the index is for an empty
phandle. The mailbox core overwrote the error return code with a less
precise -ENODEV. Use the error returned code from
of_parse_phandle_with_args().

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
This commit is contained in:
Tudor Ambarus 2025-02-24 08:27:13 +00:00 committed by Jassi Brar
parent d3e2ea6497
commit 24fdd5074b

View File

@ -415,11 +415,12 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
mutex_lock(&con_mutex); mutex_lock(&con_mutex);
if (of_parse_phandle_with_args(dev->of_node, "mboxes", ret = of_parse_phandle_with_args(dev->of_node, "mboxes", "#mbox-cells",
"#mbox-cells", index, &spec)) { index, &spec);
if (ret) {
dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__); dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__);
mutex_unlock(&con_mutex); mutex_unlock(&con_mutex);
return ERR_PTR(-ENODEV); return ERR_PTR(ret);
} }
chan = ERR_PTR(-EPROBE_DEFER); chan = ERR_PTR(-EPROBE_DEFER);