Skip to content

Commit 3a7d93d

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Use dev_err_probe to bail out
Improve the error logging in the driver probe failure paths. Also use dev_err_probe which is probe error check and log helper to prevent logging in case of probe deferral. Signed-off-by: Cristian Marussi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sudeep Holla <[email protected]>
1 parent 264a2c5 commit 3a7d93d

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

drivers/firmware/arm_scmi/driver.c

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,10 @@ scmi_txrx_setup(struct scmi_info *info, struct device_node *of_node,
25402540
ret = 0;
25412541
}
25422542

2543+
if (ret)
2544+
dev_err(info->dev,
2545+
"failed to setup channel for protocol:0x%X\n", prot_id);
2546+
25432547
return ret;
25442548
}
25452549

@@ -2809,6 +2813,7 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_info *info)
28092813
static int scmi_probe(struct platform_device *pdev)
28102814
{
28112815
int ret;
2816+
char *err_str = "probe failure\n";
28122817
struct scmi_handle *handle;
28132818
const struct scmi_desc *desc;
28142819
struct scmi_info *info;
@@ -2859,27 +2864,37 @@ static int scmi_probe(struct platform_device *pdev)
28592864

28602865
if (desc->ops->link_supplier) {
28612866
ret = desc->ops->link_supplier(dev);
2862-
if (ret)
2867+
if (ret) {
2868+
err_str = "transport not ready\n";
28632869
goto clear_ida;
2870+
}
28642871
}
28652872

28662873
/* Setup all channels described in the DT at first */
28672874
ret = scmi_channels_setup(info);
2868-
if (ret)
2875+
if (ret) {
2876+
err_str = "failed to setup channels\n";
28692877
goto clear_ida;
2878+
}
28702879

28712880
ret = bus_register_notifier(&scmi_bus_type, &info->bus_nb);
2872-
if (ret)
2881+
if (ret) {
2882+
err_str = "failed to register bus notifier\n";
28732883
goto clear_txrx_setup;
2884+
}
28742885

28752886
ret = blocking_notifier_chain_register(&scmi_requested_devices_nh,
28762887
&info->dev_req_nb);
2877-
if (ret)
2888+
if (ret) {
2889+
err_str = "failed to register device notifier\n";
28782890
goto clear_bus_notifier;
2891+
}
28792892

28802893
ret = scmi_xfer_info_init(info);
2881-
if (ret)
2894+
if (ret) {
2895+
err_str = "failed to init xfers pool\n";
28822896
goto clear_dev_req_notifier;
2897+
}
28832898

28842899
if (scmi_top_dentry) {
28852900
info->dbg = scmi_debugfs_common_setup(info);
@@ -2916,9 +2931,11 @@ static int scmi_probe(struct platform_device *pdev)
29162931
*/
29172932
ret = scmi_protocol_acquire(handle, SCMI_PROTOCOL_BASE);
29182933
if (ret) {
2919-
dev_err(dev, "unable to communicate with SCMI\n");
2920-
if (coex)
2934+
err_str = "unable to communicate with SCMI\n";
2935+
if (coex) {
2936+
dev_err(dev, err_str);
29212937
return 0;
2938+
}
29222939
goto notification_exit;
29232940
}
29242941

@@ -2972,7 +2989,8 @@ static int scmi_probe(struct platform_device *pdev)
29722989
scmi_cleanup_txrx_channels(info);
29732990
clear_ida:
29742991
ida_free(&scmi_id, info->id);
2975-
return ret;
2992+
2993+
return dev_err_probe(dev, ret, err_str);
29762994
}
29772995

29782996
static void scmi_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)