Skip to content

Commit

Permalink
ASoC: dmic: Fix check of return value from read of 'num-channels'
Browse files Browse the repository at this point in the history
Commit 7fb59e9 ("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: 7fb59e9 ("ASoC: codecs: dmic: Make number of channels configurable")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Matthias Kaehlcke authored and Mark Brown committed Jan 22, 2018
1 parent 7fb59e9 commit 35b84bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/codecs/dmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 35b84bf

Please sign in to comment.