From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: linux-kernel@vger.kernel.org, andre.draszik@linaro.org,
peter.griffin@linaro.org, willmcvicker@google.com,
kernel-team@android.com,
Tudor Ambarus <tudor.ambarus@linaro.org>
Subject: [PATCH v2 1/6] mailbox: use error ret code of of_parse_phandle_with_args()
Date: Mon, 24 Feb 2025 08:27:13 +0000 [thread overview]
Message-ID: <20250224-mbox-mutex-v2-1-9d699148fe4e@linaro.org> (raw)
In-Reply-To: <20250224-mbox-mutex-v2-0-9d699148fe4e@linaro.org>
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>
---
drivers/mailbox/mailbox.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index d3d26a2c9895..cb174e788a96 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -415,11 +415,12 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
mutex_lock(&con_mutex);
- if (of_parse_phandle_with_args(dev->of_node, "mboxes",
- "#mbox-cells", index, &spec)) {
+ ret = of_parse_phandle_with_args(dev->of_node, "mboxes", "#mbox-cells",
+ index, &spec);
+ if (ret) {
dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__);
mutex_unlock(&con_mutex);
- return ERR_PTR(-ENODEV);
+ return ERR_PTR(ret);
}
chan = ERR_PTR(-EPROBE_DEFER);
--
2.48.1.601.g30ceb7b040-goog
next prev parent reply other threads:[~2025-02-24 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 8:27 [PATCH v2 0/6] mailbox: core cleanup patches Tudor Ambarus
2025-02-24 8:27 ` Tudor Ambarus [this message]
2025-02-24 8:27 ` [PATCH v2 2/6] mailbox: don't protect of_parse_phandle_with_args with con_mutex Tudor Ambarus
2025-02-24 8:27 ` [PATCH v2 3/6] mailbox: sort headers alphabetically Tudor Ambarus
2025-02-24 8:27 ` [PATCH v2 4/6] mailbox: explicitly include <linux/bits.h> Tudor Ambarus
2025-02-24 8:27 ` [PATCH v2 5/6] mailbox: remove unused header files Tudor Ambarus
2025-02-24 8:27 ` [PATCH v2 6/6] MAINTAINERS: add mailbox API's tree type and location Tudor Ambarus
2025-02-24 8:28 ` [PATCH v2 0/6] mailbox: core cleanup patches Tudor Ambarus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250224-mbox-mutex-v2-1-9d699148fe4e@linaro.org \
--to=tudor.ambarus@linaro.org \
--cc=andre.draszik@linaro.org \
--cc=jassisinghbrar@gmail.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=willmcvicker@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®