From: Adrian Hunter <adrian.hunter@intel.com>
To: Artem Shimko <a.shimko.dev@gmail.com>,
<andriy.shevchenko@intel.com>, <ulfh@kernel.org>,
<p.zabel@pengutronix.de>
Cc: <linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths
Date: Fri, 22 May 2026 09:17:38 +0300 [thread overview]
Message-ID: <98721452-4cfa-41e7-b8c8-ec75a376e3e9@intel.com> (raw)
In-Reply-To: <20260521083506.356422-4-a.shimko.dev@gmail.com>
On 21/05/2026 11:35, Artem Shimko wrote:
> 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.
>
> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.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 925fff1c0f3a..b16027f5dd8c 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));
prev parent reply other threads:[~2026-05-22 6:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 8:35 [PATCH v2 0/3] mmc: sdhci-of-dwcmshc: minor cleanups Artem Shimko
2026-05-21 8:35 ` [PATCH v2 1/3] mmc: sdhci-of-dwcmshc: improve delay and sleep handling with fsleep() Artem Shimko
2026-05-22 6:01 ` Adrian Hunter
2026-05-22 6:58 ` Artem Shimko
2026-05-22 7:11 ` Adrian Hunter
2026-05-21 8:35 ` [PATCH v2 2/3] mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check Artem Shimko
2026-05-21 8:35 ` [PATCH v2 3/3] mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths Artem Shimko
2026-05-22 6:17 ` Adrian Hunter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98721452-4cfa-41e7-b8c8-ec75a376e3e9@intel.com \
--to=adrian.hunter@intel.com \
--cc=a.shimko.dev@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=ulfh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome