Skip to content

Commit 75499b3

Browse files
z3ntuandersson
authored andcommitted
rpmsg: qcom_smd: Improve error handling for qcom_smd_parse_edge
When the mailbox driver has not probed yet, the error message "failed to parse smd edge" is just going to confuse users, so improve the error prints a bit. Cover the last remaining exits from qcom_smd_parse_edge with proper error prints, especially the one for the mbox_chan deserved dev_err_probe to handle EPROBE_DEFER nicely. And add one for ipc_regmap also to be complete. With this done, we can remove the outer print completely. Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Luca Weiss <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 3a70b94 commit 75499b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/rpmsg/qcom_smd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,8 @@ static int qcom_smd_parse_edge(struct device *dev,
13691369
edge->mbox_chan = mbox_request_channel(&edge->mbox_client, 0);
13701370
if (IS_ERR(edge->mbox_chan)) {
13711371
if (PTR_ERR(edge->mbox_chan) != -ENODEV) {
1372-
ret = PTR_ERR(edge->mbox_chan);
1372+
ret = dev_err_probe(dev, PTR_ERR(edge->mbox_chan),
1373+
"failed to acquire IPC mailbox\n");
13731374
goto put_node;
13741375
}
13751376

@@ -1386,6 +1387,7 @@ static int qcom_smd_parse_edge(struct device *dev,
13861387
of_node_put(syscon_np);
13871388
if (IS_ERR(edge->ipc_regmap)) {
13881389
ret = PTR_ERR(edge->ipc_regmap);
1390+
dev_err(dev, "failed to get regmap from syscon: %d\n", ret);
13891391
goto put_node;
13901392
}
13911393

@@ -1501,10 +1503,8 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
15011503
}
15021504

15031505
ret = qcom_smd_parse_edge(&edge->dev, node, edge);
1504-
if (ret) {
1505-
dev_err(&edge->dev, "failed to parse smd edge\n");
1506+
if (ret)
15061507
goto unregister_dev;
1507-
}
15081508

15091509
ret = qcom_smd_create_chrdev(edge);
15101510
if (ret) {

0 commit comments

Comments
 (0)