[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240830104200.20519-1-chenyufan@vivo.com>
Date: Fri, 30 Aug 2024 18:42:00 +0800
From: Chen Yufan <chenyufan@...o.com>
To: Neil Armstrong <neil.armstrong@...aro.org>,
Jerome Brunet <jbrunet@...libre.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Kevin Hilman <khilman@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
linux-amlogic@...ts.infradead.org,
linux-clk@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: opensource.kernel@...o.com,
Chen Yufan <chenyufan@...o.com>
Subject: [PATCH v2] clk: meson: axg-audio: Use dev_err_probe() to simplfy code
Use dev_err_probe() can make code a bit simpler.
Signed-off-by: Chen Yufan <chenyufan@...o.com>
---
The modifications made compared to the previous version are as follows:
1. Change missing dev_err() to dev_err_probe().
2. Remove the extra "%ld" in "dev_err_probe
(dev, PTR_ERR(map), "failed to init regmap: %ld\n")".
---
drivers/clk/meson/axg-audio.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c
index e03a5bf899c0..c3d2d483c61b 100644
--- a/drivers/clk/meson/axg-audio.c
+++ b/drivers/clk/meson/axg-audio.c
@@ -1761,10 +1761,8 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
return PTR_ERR(regs);
map = devm_regmap_init_mmio(dev, regs, &axg_audio_regmap_cfg);
- if (IS_ERR(map)) {
- dev_err(dev, "failed to init regmap: %ld\n", PTR_ERR(map));
- return PTR_ERR(map);
- }
+ if (IS_ERR(map))
+ return dev_err_probe(dev, PTR_ERR(map), "failed to init regmap\n");
/* Get the mandatory peripheral clock */
clk = devm_clk_get_enabled(dev, "pclk");
@@ -1772,10 +1770,8 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
return PTR_ERR(clk);
ret = device_reset(dev);
- if (ret) {
- dev_err_probe(dev, ret, "failed to reset device\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to reset device\n");
/* Populate regmap for the regmap backed clocks */
for (i = 0; i < data->regmap_clk_num; i++)
@@ -1793,10 +1789,8 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
name = hw->init->name;
ret = devm_clk_hw_register(dev, hw);
- if (ret) {
- dev_err(dev, "failed to register clock %s\n", name);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register clock %s\n", name);
}
ret = devm_of_clk_add_hw_provider(dev, meson_clk_hw_get, (void *)&data->hw_clks);
--
2.39.0
Powered by blists - more mailing lists