ASoC: dmic: Fix check of return value from read of 'num-channels'
"Linux Kernel Mailing List" <[email protected]>
| Newsgroups | gmane.linux.kernel.commits.head |
|---|---|
| Message-ID | <[email protected]> |
Web: https://git.kernel.org/torvalds/c/35b84bf0614a7da98bfbbac70ed3d01c3b5b6c58 Commit: 35b84bf0614a7da98bfbbac70ed3d01c3b5b6c58 Parent: 7fb59e940f6225beed0b24cd09e9fad9aebb7565 Refname: refs/heads/master Author: Matthias Kaehlcke <[email protected]> AuthorDate: Fri Jan 19 15:36:50 2018 -0800 Committer: Mark Brown <[email protected]> CommitDate: Mon Jan 22 12:20:46 2018 +0000 ASoC: dmic: Fix check of return value from read of 'num-channels' 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 <[email protected]> Signed-off-by: Mark Brown <[email protected]> --- 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) { -- To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html