summaryrefslogtreecommitdiff
path: root/drivers/sound
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sound')
-rw-r--r--drivers/sound/sound-uclass.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c
index c213472d60..bada0c2ba5 100644
--- a/drivers/sound/sound-uclass.c
+++ b/drivers/sound/sound-uclass.c
@@ -97,11 +97,14 @@ int sound_beep(struct udevice *dev, int msecs, int frequency_hz)
sound_create_square_wave(i2s_uc_priv->samplingrate, data, data_size,
frequency_hz, i2s_uc_priv->channels);
+ ret = 0;
while (msecs >= 1000) {
ret = sound_play(dev, data, data_size);
+ if (ret)
+ break;
msecs -= 1000;
}
- if (msecs) {
+ if (!ret && msecs) {
unsigned long size =
(data_size * msecs) / (sizeof(int) * 1000);