Skip to content

Commit 85aeab3

Browse files
vijendarmukundabroonie
authored andcommitted
ASoC: amd: acp: fix for invalid dai id handling in acp_get_byte_count()
For invalid dai id, instead of returning -EINVAL return bytes count as zero in acp_get_byte_count() function. Fixes: 623621a ("ASoC: amd: Add common framework to support I2S on ACP SOC") Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20230626105356.2580125-6-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 68a653a commit 85aeab3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

sound/soc/amd/acp/amd.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ int snd_amd_acp_find_config(struct pci_dev *pci);
173173

174174
static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction)
175175
{
176-
u64 byte_count, low = 0, high = 0;
176+
u64 byte_count = 0, low = 0, high = 0;
177177

178178
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
179179
switch (dai_id) {
@@ -191,7 +191,7 @@ static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int
191191
break;
192192
default:
193193
dev_err(adata->dev, "Invalid dai id %x\n", dai_id);
194-
return -EINVAL;
194+
goto POINTER_RETURN_BYTES;
195195
}
196196
} else {
197197
switch (dai_id) {
@@ -213,12 +213,13 @@ static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int
213213
break;
214214
default:
215215
dev_err(adata->dev, "Invalid dai id %x\n", dai_id);
216-
return -EINVAL;
216+
goto POINTER_RETURN_BYTES;
217217
}
218218
}
219219
/* Get 64 bit value from two 32 bit registers */
220220
byte_count = (high << 32) | low;
221221

222+
POINTER_RETURN_BYTES:
222223
return byte_count;
223224
}
224225

0 commit comments

Comments
 (0)