From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756230AbeASXhc (ORCPT ); Fri, 19 Jan 2018 18:37:32 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36006 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753670AbeASXhY (ORCPT ); Fri, 19 Jan 2018 18:37:24 -0500 X-Google-Smtp-Source: AH8x225OkjKuxXo1GN9/TDEJLMxeNicUEW0bpZ/D7TwcpANscpDAuyCWHbvhkAqyLxcTdO0kYbk6vQ== From: Matthias Kaehlcke To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Matthias Kaehlcke Subject: [PATCH] ASoC: codecs: dmic: Fix check of return value from read of 'num-channels' Date: Fri, 19 Jan 2018 15:36:50 -0800 Message-Id: <20180119233650.100472-1-mka@chromium.org> X-Mailer: git-send-email 2.16.0.rc1.238.g530d649a79-goog Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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