Commit ba72aff7 authored by morten petersen's avatar morten petersen Committed by Stefan Bader

mailbox: handle failed named mailbox channel request

BugLink: https://bugs.launchpad.net/bugs/1840081

[ Upstream commit 25777e57 ]

Previously, if mbox_request_channel_byname was used with a name
which did not exist in the "mbox-names" property of a mailbox
client, the mailbox corresponding to the last entry in the
"mbox-names" list would be incorrectly selected.
With this patch, -EINVAL is returned if the named mailbox is
not found.
Signed-off-by: default avatarMorten Borup Petersen <morten_bp@live.dk>
Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent ef04042d
...@@ -389,11 +389,13 @@ struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl, ...@@ -389,11 +389,13 @@ struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
of_property_for_each_string(np, "mbox-names", prop, mbox_name) { of_property_for_each_string(np, "mbox-names", prop, mbox_name) {
if (!strncmp(name, mbox_name, strlen(name))) if (!strncmp(name, mbox_name, strlen(name)))
break; return mbox_request_channel(cl, index);
index++; index++;
} }
return mbox_request_channel(cl, index); dev_err(cl->dev, "%s() could not locate channel named \"%s\"\n",
__func__, name);
return ERR_PTR(-EINVAL);
} }
EXPORT_SYMBOL_GPL(mbox_request_channel_byname); EXPORT_SYMBOL_GPL(mbox_request_channel_byname);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment