]> git.hungrycats.org Git - linux/commitdiff
ASoC: pxa: Use devm_clk_get_optional() for extclk clock
authorbui duc phuc <phucduc.bui@gmail.com>
Tue, 11 Aug 2026 10:09:49 +0000 (17:09 +0700)
committerMark Brown <broonie@kernel.org>
Tue, 11 Aug 2026 21:06:59 +0000 (22:06 +0100)
The Device Tree binding defines the extclk clock as an optional
property, but the driver currently uses devm_clk_get() and manually
handles the absence of the clock.

Use devm_clk_get_optional() to match the binding and simplify the
optional clock handling. This also propagates errors other than the
absence of the optional clock, including -EPROBE_DEFER.

This changes the existing behavior for errors other than
-EPROBE_DEFER. RFC to discuss whether these errors should cause probe
to fail rather than being treated as an unavailable optional clock.

Fixes: 90eb6b59d311 ("ASoC: pxa-ssp: add support for an external clock in devicetree")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260811100949.61142-1-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/pxa/pxa-ssp.c

index f8054c1c59fae74e17d1e66b50efbcaa3292c3b1..3a0abcb0bfbdf2e85836e8595343cb8368679dd5 100644 (file)
@@ -769,13 +769,10 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai)
                        goto err_priv;
                }
 
-               priv->extclk = devm_clk_get(dev, "extclk");
+               priv->extclk = devm_clk_get_optional(dev, "extclk");
                if (IS_ERR(priv->extclk)) {
                        ret = PTR_ERR(priv->extclk);
-                       if (ret == -EPROBE_DEFER)
-                               goto err_priv;
-
-                       priv->extclk = NULL;
+                       goto err_priv;
                }
        } else {
                priv->ssp = pxa_ssp_request(dai->id + 1, "SoC audio");