[PATCH next] ASoC: cs42l43: Fix missing error code in cs42l43_codec_probe()
When clk_get_optional() fails, the error handling code does a 'goto err_pm' with ret = 0, which is resturning success on a failure path.
Fix this by assigning the PTR_ERR(priv->mclk) to ret variable.
Fixes: fc918cbe874e ("ASoC: cs42l43: Add support for the cs42l43") Signed-off-by: Harshit Mogalapalli harshit.m.mogalapalli@oracle.com --- This is based on static analysis with smatch, only compile tested. --- sound/soc/codecs/cs42l43.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index 24e718e51174..1a95c370fc4c 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -2205,7 +2205,8 @@ static int cs42l43_codec_probe(struct platform_device *pdev) // Don't use devm as we need to get against the MFD device priv->mclk = clk_get_optional(cs42l43->dev, "mclk"); if (IS_ERR(priv->mclk)) { - dev_err_probe(priv->dev, PTR_ERR(priv->mclk), "Failed to get mclk\n"); + ret = PTR_ERR(priv->mclk); + dev_err_probe(priv->dev, ret, "Failed to get mclk\n"); goto err_pm; }
On Tue, Aug 29, 2023 at 12:36:35AM -0700, Harshit Mogalapalli wrote:
When clk_get_optional() fails, the error handling code does a 'goto err_pm' with ret = 0, which is resturning success on a failure path.
Fix this by assigning the PTR_ERR(priv->mclk) to ret variable.
Fixes: fc918cbe874e ("ASoC: cs42l43: Add support for the cs42l43") Signed-off-by: Harshit Mogalapalli harshit.m.mogalapalli@oracle.com
Acked-by: Charles Keepax ckeepax@opensource.cirrus.com
Thanks, Charles
On Tue, 29 Aug 2023 00:36:35 -0700, Harshit Mogalapalli wrote:
When clk_get_optional() fails, the error handling code does a 'goto err_pm' with ret = 0, which is resturning success on a failure path.
Fix this by assigning the PTR_ERR(priv->mclk) to ret variable.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: cs42l43: Fix missing error code in cs42l43_codec_probe() commit: 9e07f8bfd959d2d09823430eab35d12182446dcf
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Charles Keepax
-
Harshit Mogalapalli
-
Mark Brown