From: Matthias Kaehlcke <mka@chromium.org>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org, Matthias Kaehlcke <mka@chromium.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: codecs: dmic: Fix check of return value from read of 'num-channels'
Date: Fri, 19 Jan 2018 15:36:50 -0800 [thread overview]
Message-ID: <20180119233650.100472-1-mka@chromium.org> (raw)
Commit 7fb59e940f62 ("ASoC: codecs: dmic: Make number of channels
configurable") introduces an optional property to the device tree
to specify the number of DMIC channels. dmic_codec_probe() uses
of_property_read_u32() to read the DT value, and expects a return
value of -ENOENT when the property does not exist. This expectation
is incorrect, the actual value returned in this case is -EINVAL (see
of_find_property_value_of_size(), which is called under the hood).
Check for -EINVAL instead.
Fixes: 7fb59e940f62 ("ASoC: codecs: dmic: Make number of channels configurable")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
sound/soc/codecs/dmic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c
index c88f974ebe3e..cf83c423394d 100644
--- a/sound/soc/codecs/dmic.c
+++ b/sound/soc/codecs/dmic.c
@@ -113,7 +113,7 @@ static int dmic_dev_probe(struct platform_device *pdev)
if (pdev->dev.of_node) {
err = of_property_read_u32(pdev->dev.of_node, "num-channels", &chans);
- if (err && (err != -ENOENT))
+ if (err && (err != -EINVAL))
return err;
if (!err) {
--
2.16.0.rc1.238.g530d649a79-goog
next reply other threads:[~2018-01-19 23:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 23:36 Matthias Kaehlcke [this message]
2018-01-22 12:21 ` [PATCH] ASoC: codecs: dmic: Fix check of return value from read of 'num-channels' Mark Brown
2018-01-22 12:26 ` Applied "ASoC: dmic: Fix check of return value from read of 'num-channels'" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180119233650.100472-1-mka@chromium.org \
--to=mka@chromium.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox