From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Longbin Li <looong.bin@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Mark Brown <broonie@kernel.org>
Subject: [PATCH v1 2/2] spi: sg2044-nor: Convert to dev_err_probe()
Date: Wed, 12 Mar 2025 19:19:17 +0200 [thread overview]
Message-ID: <20250312172016.4070094-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20250312172016.4070094-1-andriy.shevchenko@linux.intel.com>
One of the cases in sg2044_spifmc_probe() may be converted to use
dev_err_probe(). Do it.
While at it, use local device pointer in all such calls and drop
unneeded __func__ parameter as dev_err_probe() is assumed to be called
only during probe phase.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/spi/spi-sg2044-nor.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-sg2044-nor.c b/drivers/spi/spi-sg2044-nor.c
index e104cac57d41..572792a59195 100644
--- a/drivers/spi/spi-sg2044-nor.c
+++ b/drivers/spi/spi-sg2044-nor.c
@@ -425,6 +425,7 @@ static void sg2044_spifmc_init(struct sg2044_spifmc *spifmc)
static int sg2044_spifmc_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct spi_controller *ctrl;
struct sg2044_spifmc *spifmc;
void __iomem *base;
@@ -438,9 +439,7 @@ static int sg2044_spifmc_probe(struct platform_device *pdev)
spifmc->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(spifmc->clk))
- return dev_err_probe(&pdev->dev, PTR_ERR(spifmc->clk),
- "%s: Cannot get and enable AHB clock\n",
- __func__);
+ return dev_err_probe(dev, PTR_ERR(spifmc->clk), "Cannot get and enable AHB clock\n");
spifmc->dev = &pdev->dev;
spifmc->ctrl = ctrl;
@@ -464,10 +463,8 @@ static int sg2044_spifmc_probe(struct platform_device *pdev)
sg2044_spifmc_init_reg(spifmc);
ret = devm_spi_register_controller(&pdev->dev, ctrl);
- if (ret) {
- dev_err(&pdev->dev, "spi_register_controller failed\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "spi_register_controller failed\n");
return 0;
}
--
2.47.2
prev parent reply other threads:[~2025-03-12 17:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 17:19 [PATCH v1 0/2] spi: sg2044-nor: A couple of cleanups Andy Shevchenko
2025-03-12 17:19 ` [PATCH v1 1/2] spi: sg2044-nor: Fully convert to device managed resources Andy Shevchenko
2025-03-12 23:34 ` kernel test robot
2025-03-13 9:20 ` Andy Shevchenko
2025-03-13 0:51 ` kernel test robot
2025-03-12 17:19 ` Andy Shevchenko [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=20250312172016.4070094-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=looong.bin@gmail.com \
/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