summaryrefslogtreecommitdiff
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorArtem Shimko <a.shimko.dev@gmail.com>2026-05-22 10:31:32 +0300
committerUlf Hansson <ulfh@kernel.org>2026-05-29 14:48:50 +0200
commit23d4f4316a71e04c34c7c5e03a662cc59f9ccb80 (patch)
tree30b692006e5c6d19d46e8fd13ea9d9432ee93c52 /drivers/mmc/host
parent423ab671bb921206bab25ffe61adc5da98a64e6c (diff)
downloadlinux-next-23d4f4316a71e04c34c7c5e03a662cc59f9ccb80.tar.gz
linux-next-23d4f4316a71e04c34c7c5e03a662cc59f9ccb80.zip
mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths
Replace common pattern of dev_err() + return with dev_err_probe() in probe functions and their callees. This macro provides standardized error message format with symbolic error names and adds deferred probe debugging information. The conversion makes the code more compact and ensures consistent error logging across all initialization paths. Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/sdhci-of-dwcmshc.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index 0786304e7a2f..eef53455b8ee 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -918,11 +918,9 @@ static int dwcmshc_rk35xx_init(struct device *dev, struct sdhci_host *host,
return -ENOMEM;
priv->reset = devm_reset_control_array_get_optional_exclusive(mmc_dev(host->mmc));
- if (IS_ERR(priv->reset)) {
- err = PTR_ERR(priv->reset);
- dev_err(mmc_dev(host->mmc), "failed to get reset control %d\n", err);
- return err;
- }
+ if (IS_ERR(priv->reset))
+ return dev_err_probe(mmc_dev(host->mmc), PTR_ERR(priv->reset),
+ "failed to get reset control\n");
err = dwcmshc_get_enable_other_clks(mmc_dev(host->mmc), dwc_priv,
ARRAY_SIZE(clk_ids), clk_ids);
@@ -1779,10 +1777,8 @@ static int eic7700_init(struct device *dev, struct sdhci_host *host, struct dwcm
dwc_priv->priv = priv;
ret = sdhci_eic7700_reset_init(dev, dwc_priv->priv);
- if (ret) {
- dev_err(dev, "failed to reset\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to reset\n");
ret = dwcmshc_get_enable_other_clks(mmc_dev(host->mmc), dwc_priv,
ARRAY_SIZE(clk_ids), clk_ids);
@@ -1790,16 +1786,14 @@ static int eic7700_init(struct device *dev, struct sdhci_host *host, struct dwcm
return ret;
ret = of_parse_phandle_with_fixed_args(dev->of_node, "eswin,hsp-sp-csr", 2, 0, &args);
- if (ret) {
- dev_err(dev, "Fail to parse 'eswin,hsp-sp-csr' phandle (%d)\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Fail to parse 'eswin,hsp-sp-csr' phandle\n");
hsp_regmap = syscon_node_to_regmap(args.np);
if (IS_ERR(hsp_regmap)) {
- dev_err(dev, "Failed to get regmap for 'eswin,hsp-sp-csr'\n");
of_node_put(args.np);
- return PTR_ERR(hsp_regmap);
+ return dev_err_probe(dev, PTR_ERR(hsp_regmap),
+ "Failed to get regmap for 'eswin,hsp-sp-csr'\n");
}
hsp_int_status = args.args[0];
hsp_pwr_ctrl = args.args[1];
@@ -2408,10 +2402,8 @@ static int dwcmshc_probe(struct platform_device *pdev)
u32 extra, caps;
pltfm_data = device_get_match_data(&pdev->dev);
- if (!pltfm_data) {
- dev_err(&pdev->dev, "Error: No device match data found\n");
- return -ENODEV;
- }
+ if (!pltfm_data)
+ return dev_err_probe(&pdev->dev, -ENODEV, "No device match data found\n");
host = sdhci_pltfm_init(pdev, &pltfm_data->pdata,
sizeof(struct dwcmshc_priv));