Skip to content

Commit 29528c8

Browse files
Shenghao-Dingbroonie
authored andcommitted
ASoC: tas2781: fix getting the wrong device number
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: ef3bcde ("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>
1 parent 3dc8c73 commit 29528c8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

sound/soc/codecs/tas2781-i2c.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,8 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
19571957
{
19581958
struct i2c_client *client = (struct i2c_client *)tas_priv->client;
19591959
unsigned int dev_addrs[TASDEVICE_MAX_CHANNELS];
1960-
int i, ndev = 0;
1960+
int ndev = 0;
1961+
int i, rc;
19611962

19621963
if (tas_priv->isacpi) {
19631964
ndev = device_property_read_u32_array(&client->dev,
@@ -1968,8 +1969,12 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
19681969
} else {
19691970
ndev = (ndev < ARRAY_SIZE(dev_addrs))
19701971
? ndev : ARRAY_SIZE(dev_addrs);
1971-
ndev = device_property_read_u32_array(&client->dev,
1972+
rc = device_property_read_u32_array(&client->dev,
19721973
"ti,audio-slots", dev_addrs, ndev);
1974+
if (rc != 0) {
1975+
ndev = 1;
1976+
dev_addrs[0] = client->addr;
1977+
}
19731978
}
19741979

19751980
tas_priv->irq =

0 commit comments

Comments
 (0)