summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorSteffen Aschbacher <steffen.aschbacher@stihl.de>2023-02-13 08:38:05 +0100
committerMark Brown <broonie@kernel.org>2023-02-13 13:45:19 +0100
commit771725efe5e2e5396dd9d1220437e5f9d6b9ca9d (patch)
tree74d70e5ce671749a51c1355edfb198debb928cdf /sound/soc
parentASoC: codecs: Modify error implicit declaration of function 'gpiod_set_value_... (diff)
downloadlinux-771725efe5e2e5396dd9d1220437e5f9d6b9ca9d.tar.xz
linux-771725efe5e2e5396dd9d1220437e5f9d6b9ca9d.zip
ASoC: tlv320adcx140: fix 'ti,gpio-config' DT property init
When the 'ti,gpio-config' property is not defined, the device_property_count_u32() will return an error, rather than zero. The current check, only handles a return value of zero, which assumes that the property is defined and has nothing defined. This change extends the check to also check for an error case (most likely to be hit by the case that the 'ti,gpio-config' is not defined). In case that the 'ti,gpio-config' and the returned 'gpio_count' is not correct, there is a 'if (gpio_count != ADCX140_NUM_GPIO_CFGS)' check, a few lines lower that will return -EINVAL. This means that someone tried to define 'ti,gpio-config', but with the wrong number of GPIOs. Fixes: d5214321498a ("ASoC: tlv320adcx140: Add support for configuring GPIO pin") Signed-off-by: Steffen Aschbacher <steffen.aschbacher@stihl.de> Signed-off-by: Alexandru Ardelean <alex@shruggie.ro> Link: https://lore.kernel.org/r/20230213073805.14640-1-alex@shruggie.ro Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/tlv320adcx140.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 91a22d927915..530f321d08e9 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -925,7 +925,7 @@ static int adcx140_configure_gpio(struct adcx140_priv *adcx140)
gpio_count = device_property_count_u32(adcx140->dev,
"ti,gpio-config");
- if (gpio_count == 0)
+ if (gpio_count <= 0)
return 0;
if (gpio_count != ADCX140_NUM_GPIO_CFGS)