Skip to content

Commit 24fdd50

Browse files
ambarusJassi Brar
authored andcommitted
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>
1 parent d3e2ea6 commit 24fdd50

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/mailbox/mailbox.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,12 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
415415

416416
mutex_lock(&con_mutex);
417417

418-
if (of_parse_phandle_with_args(dev->of_node, "mboxes",
419-
"#mbox-cells", index, &spec)) {
418+
ret = of_parse_phandle_with_args(dev->of_node, "mboxes", "#mbox-cells",
419+
index, &spec);
420+
if (ret) {
420421
dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__);
421422
mutex_unlock(&con_mutex);
422-
return ERR_PTR(-ENODEV);
423+
return ERR_PTR(ret);
423424
}
424425

425426
chan = ERR_PTR(-EPROBE_DEFER);

0 commit comments

Comments
 (0)