Skip to content

Commit 67430a3

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: wm_adsp: Return an error on write to a disabled volatile control
Volatile controls should only be accessed when the firmware is active, currently however writes to these controls will succeed, but the data will be lost, if the firmware is powered down. Update this behaviour such that an error is returned the same as it is for reads. Signed-off-by: Charles Keepax <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent c1ae3cf commit 67430a3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,10 @@ static int wm_coeff_put(struct snd_kcontrol *kctl,
899899

900900
mutex_lock(&ctl->dsp->pwr_lock);
901901

902-
memcpy(ctl->cache, p, ctl->len);
902+
if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
903+
ret = -EPERM;
904+
else
905+
memcpy(ctl->cache, p, ctl->len);
903906

904907
ctl->set = 1;
905908
if (ctl->enabled && ctl->dsp->running)
@@ -926,6 +929,8 @@ static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
926929
ctl->set = 1;
927930
if (ctl->enabled && ctl->dsp->running)
928931
ret = wm_coeff_write_control(ctl, ctl->cache, size);
932+
else if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
933+
ret = -EPERM;
929934
}
930935

931936
mutex_unlock(&ctl->dsp->pwr_lock);

0 commit comments

Comments
 (0)