<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <<a href="mailto:m.felsch@pengutronix.de">m.felsch@pengutronix.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Make use of the new macro to get device defered information for free<br>
and to cleanup the code a bit. No functional changes.<br>
<br>
Signed-off-by: Marco Felsch <<a href="mailto:m.felsch@pengutronix.de" target="_blank">m.felsch@pengutronix.de</a>><br>
---<br>
sound/soc/fsl/fsl_sai.c | 33 +++++++++++----------------------<br>
1 file changed, 11 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c<br>
index a7637d602f3c..3e54f1f71c1e 100644<br>
--- a/sound/soc/fsl/fsl_sai.c<br>
+++ b/sound/soc/fsl/fsl_sai.c<br>
@@ -1034,21 +1034,15 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
}<br>
<br>
sai->regmap = devm_regmap_init_mmio(dev, base, &fsl_sai_regmap_config);<br>
- if (IS_ERR(sai->regmap)) {<br>
- dev_err(dev, "regmap init failed\n");<br>
- return PTR_ERR(sai->regmap);<br>
- }<br>
+ if (IS_ERR(sai->regmap))<br>
+ return dev_err_probe(dev, PTR_ERR(sai->regmap), "regmap init failed\n");<br>
<br>
sai->bus_clk = devm_clk_get(dev, "bus");<br>
/* Compatible with old DTB cases */<br>
if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)<br>
sai->bus_clk = devm_clk_get(dev, "sai");<br>
- if (IS_ERR(sai->bus_clk)) {<br>
- dev_err(dev, "failed to get bus clock: %ld\n",<br>
- PTR_ERR(sai->bus_clk));<br>
- /* -EPROBE_DEFER */<br>
- return PTR_ERR(sai->bus_clk);<br>
- }<br>
+ if (IS_ERR(sai->bus_clk))<br>
+ return dev_err_probe(dev, PTR_ERR(sai->bus_clk), "failed to get bus clock\n");<br>
<br>
for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {<br>
sprintf(tmp, "mclk%d", i);<br>
@@ -1067,14 +1061,12 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
<br>
irq = platform_get_irq(pdev, 0);<br>
if (irq < 0)<br>
- return irq;<br>
+ return dev_err_probe(dev, irq, "failed to get the irq\n");<br></blockquote><div><br></div><div>This change is not needed, platform_get_irq() has done the same operation.</div><div><br></div><div>best regards</div><div>wang shengjiu</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,<br>
np->name, sai);<br>
- if (ret) {<br>
- dev_err(dev, "failed to claim irq %u\n", irq);<br>
- return ret;<br>
- }<br>
+ if (ret)<br>
+ return dev_err_probe(dev, ret, "failed to claim irq %u\n", irq);<br>
<br>
memcpy(&sai->cpu_dai_drv, &fsl_sai_dai_template,<br>
sizeof(fsl_sai_dai_template));<br>
@@ -1089,8 +1081,7 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&<br>
of_find_property(np, "fsl,sai-asynchronous", NULL)) {<br>
/* error out if both synchronous and asynchronous are present */<br>
- dev_err(dev, "invalid binding for synchronous mode\n");<br>
- return -EINVAL;<br>
+ return dev_err_probe(dev, -EINVAL, "invalid binding for synchronous mode\n");<br>
}<br>
<br>
if (of_find_property(np, "fsl,sai-synchronous-rx", NULL)) {<br>
@@ -1109,14 +1100,12 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&<br>
of_device_is_compatible(np, "fsl,imx6ul-sai")) {<br>
gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");<br>
- if (IS_ERR(gpr)) {<br>
- dev_err(dev, "cannot find iomuxc registers\n");<br>
- return PTR_ERR(gpr);<br>
- }<br>
+ if (IS_ERR(gpr))<br>
+ return dev_err_probe(dev, PTR_ERR(gpr), "cannot find iomuxc registers\n");<br>
<br>
index = of_alias_get_id(np, "sai");<br>
if (index < 0)<br>
- return index;<br>
+ return dev_err_probe(dev, index, "cannot find sai aliases\n");<br>
<br>
regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index),<br>
MCLK_DIR(index));<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>