summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShenghao Ding <shenghao-ding@ti.com>2025-11-07 13:49:59 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-24 10:35:54 +0100
commitf2fcc305b4dce7238c861f7f93a75705719e5488 (patch)
treecf1229261573cacfc158a030954008cbc30592b1 /sound
parent5aea2cde03d4247cdcf53f9ab7d0747c9dca1cfc (diff)
downloadlinux-f2fcc305b4dce7238c861f7f93a75705719e5488.tar.gz
linux-f2fcc305b4dce7238c861f7f93a75705719e5488.tar.bz2
linux-f2fcc305b4dce7238c861f7f93a75705719e5488.zip
ASoC: tas2781: fix getting the wrong device number
[ Upstream commit 29528c8e643bb0c54da01237a35010c6438423d2 ] The return value of device_property_read_u32_array used for getting the property is the status instead of the number of the property. Fixes: ef3bcde75d06 ("ASoC: tas2781: Add tas2781 driver") Signed-off-by: Shenghao Ding <shenghao-ding@ti.com> Link: https://patch.msgid.link/20251107054959.950-1-shenghao-ding@ti.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/tas2781-i2c.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c
index 1b2f55030c39..2f100cbfdc41 100644
--- a/sound/soc/codecs/tas2781-i2c.c
+++ b/sound/soc/codecs/tas2781-i2c.c
@@ -1635,7 +1635,8 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
{
struct i2c_client *client = (struct i2c_client *)tas_priv->client;
unsigned int dev_addrs[TASDEVICE_MAX_CHANNELS];
- int i, ndev = 0;
+ int ndev = 0;
+ int i, rc;
if (tas_priv->isacpi) {
ndev = device_property_read_u32_array(&client->dev,
@@ -1646,8 +1647,12 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
} else {
ndev = (ndev < ARRAY_SIZE(dev_addrs))
? ndev : ARRAY_SIZE(dev_addrs);
- ndev = device_property_read_u32_array(&client->dev,
+ rc = device_property_read_u32_array(&client->dev,
"ti,audio-slots", dev_addrs, ndev);
+ if (rc != 0) {
+ ndev = 1;
+ dev_addrs[0] = client->addr;
+ }
}
tas_priv->irq =