]> git.ipfire.org Git - thirdparty/linux.git/commit
ASoC: max98095: fix missing IS_ERR() before PTR_ERR() on mclk lookup
authorUday Khare <udaykhare77@gmail.com>
Mon, 20 Jul 2026 10:39:50 +0000 (16:09 +0530)
committerMark Brown <broonie@kernel.org>
Mon, 20 Jul 2026 14:49:34 +0000 (15:49 +0100)
commit317e21532e6ffa1de026bdbce5ba98e1b70ca5c6
tree679a34cea5919ba53d134d8f9743aeb987daf8fb
parenta9058504f11150308c44f6c0683eb04c822b821d
ASoC: max98095: fix missing IS_ERR() before PTR_ERR() on mclk lookup

In max98095_probe(), the -EPROBE_DEFER check after devm_clk_get() is
broken due to a missing IS_ERR() guard.

The code intends to return -EPROBE_DEFER only when the clock lookup
fails with that specific error.  However, without IS_ERR() the check:

    if (PTR_ERR(max98095->mclk) == -EPROBE_DEFER)

is called unconditionally, including when devm_clk_get() succeeds and
returns a valid pointer.  Calling PTR_ERR() on a valid pointer
reinterprets its address as a signed long; the result is arbitrary
and is almost never equal to -EPROBE_DEFER, so the check silently
does nothing in the success case.  When devm_clk_get() fails with
any error other than -EPROBE_DEFER the check is also skipped, leaving
max98095->mclk holding an error pointer with no indication to the caller.

This means a deferred probe will never actually be triggered for this
device, and any non-EPROBE_DEFER clock error is silently swallowed with
the error pointer left in the mclk field.

Fix this by adding the missing IS_ERR() guard around the PTR_ERR() call,
matching the pattern already used in the sibling max98088 and wm8960
drivers.

Fixes: e3048c3d2be5 ("ASoC: max98095: Add master clock handling")
Signed-off-by: Uday Khare <udaykhare77@gmail.com>
Link: https://patch.msgid.link/20260720103950.14474-1-udaykhare77@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/max98095.c