* [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups
@ 2026-05-22 7:31 Artem Shimko
2026-05-22 7:31 ` [PATCH v3 1/2] mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check Artem Shimko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Artem Shimko @ 2026-05-22 7:31 UTC (permalink / raw)
To: andriy.shevchenko, adrian.hunter, ulfh, p.zabel
Cc: Artem Shimko, linux-mmc, linux-kernel
Hi,
This series introduces two non-functional cleanups for the Synopsys
DWC MSHC driver.
Patch 1 removes redundant IS_ERR() checks for bus_clk in suspend/resume
paths where the called functions already have internal protection.
Patch 2 converts error handling in probe paths to use dev_err_probe()
macro for more compact code and better deferred probe debugging.
--
Best regards,
Artem
---
ChangeLog:
v1:
* https://lore.kernel.org/all/20260518110034.142587-1-a.shimko.dev@gmail.com/T/#t
v2:
* https://lore.kernel.org/all/20260521083506.356422-1-a.shimko.dev@gmail.com/T/#t
v3:
* Drop fsleep() patch to keep initial delay/sleep values
Artem Shimko (2):
mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check
mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths
drivers/mmc/host/sdhci-of-dwcmshc.c | 36 +++++++++++------------------
1 file changed, 13 insertions(+), 23 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 1/2] mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check
2026-05-22 7:31 [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups Artem Shimko
@ 2026-05-22 7:31 ` Artem Shimko
2026-05-22 7:31 ` [PATCH v3 2/2] mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths Artem Shimko
2026-05-29 14:45 ` [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Artem Shimko @ 2026-05-22 7:31 UTC (permalink / raw)
To: andriy.shevchenko, adrian.hunter, ulfh, p.zabel
Cc: Artem Shimko, linux-mmc, linux-kernel
The clk_disable_unprepare() function has internal protection against
ERR_PTR and NULL pointers (IS_ERR_OR_NULL). Remove the redundant
IS_ERR() check for bus_clk in dwcmshc_suspend() and in the error
path of dwcmshc_resume() to simplify the code.
Note that the clk_prepare_enable() call in dwcmshc_resume() must retain
its IS_ERR() check because clk_prepare() only handles NULL pointers,
not ERR_PTR.
No functional change intended.
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index 0b2158a7e409..c1ed7f28d75b 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -2564,8 +2564,7 @@ static int dwcmshc_suspend(struct device *dev)
return ret;
clk_disable_unprepare(pltfm_host->clk);
- if (!IS_ERR(priv->bus_clk))
- clk_disable_unprepare(priv->bus_clk);
+ clk_disable_unprepare(priv->bus_clk);
clk_bulk_disable_unprepare(priv->num_other_clks, priv->other_clks);
@@ -2608,8 +2607,7 @@ static int dwcmshc_resume(struct device *dev)
disable_other_clks:
clk_bulk_disable_unprepare(priv->num_other_clks, priv->other_clks);
disable_bus_clk:
- if (!IS_ERR(priv->bus_clk))
- clk_disable_unprepare(priv->bus_clk);
+ clk_disable_unprepare(priv->bus_clk);
disable_clk:
clk_disable_unprepare(pltfm_host->clk);
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/2] mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths
2026-05-22 7:31 [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups Artem Shimko
2026-05-22 7:31 ` [PATCH v3 1/2] mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check Artem Shimko
@ 2026-05-22 7:31 ` Artem Shimko
2026-05-29 14:45 ` [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Artem Shimko @ 2026-05-22 7:31 UTC (permalink / raw)
To: andriy.shevchenko, adrian.hunter, ulfh, p.zabel
Cc: Artem Shimko, linux-mmc, linux-kernel
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>
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 30 +++++++++++------------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index c1ed7f28d75b..c758e904f5c8 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -917,11 +917,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);
@@ -1781,10 +1779,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);
@@ -1792,16 +1788,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));
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups
2026-05-22 7:31 [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups Artem Shimko
2026-05-22 7:31 ` [PATCH v3 1/2] mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check Artem Shimko
2026-05-22 7:31 ` [PATCH v3 2/2] mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths Artem Shimko
@ 2026-05-29 14:45 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2026-05-29 14:45 UTC (permalink / raw)
To: Artem Shimko
Cc: andriy.shevchenko, adrian.hunter, ulfh, p.zabel, linux-mmc,
linux-kernel
On Fri, May 22, 2026 at 9:31 AM Artem Shimko <a.shimko.dev@gmail.com> wrote:
>
> Hi,
>
> This series introduces two non-functional cleanups for the Synopsys
> DWC MSHC driver.
>
> Patch 1 removes redundant IS_ERR() checks for bus_clk in suspend/resume
> paths where the called functions already have internal protection.
>
> Patch 2 converts error handling in probe paths to use dev_err_probe()
> macro for more compact code and better deferred probe debugging.
>
> --
> Best regards,
> Artem
> ---
> ChangeLog:
> v1:
> * https://lore.kernel.org/all/20260518110034.142587-1-a.shimko.dev@gmail.com/T/#t
> v2:
> * https://lore.kernel.org/all/20260521083506.356422-1-a.shimko.dev@gmail.com/T/#t
> v3:
> * Drop fsleep() patch to keep initial delay/sleep values
>
> Artem Shimko (2):
> mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check
> mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths
>
> drivers/mmc/host/sdhci-of-dwcmshc.c | 36 +++++++++++------------------
> 1 file changed, 13 insertions(+), 23 deletions(-)
>
> --
> 2.43.0
The series applied for next, thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-29 14:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22 7:31 [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups Artem Shimko
2026-05-22 7:31 ` [PATCH v3 1/2] mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check Artem Shimko
2026-05-22 7:31 ` [PATCH v3 2/2] mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths Artem Shimko
2026-05-29 14:45 ` [PATCH v3 0/2] mmc: sdhci-of-dwcmshc: minor cleanups Ulf Hansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.