diff options
author | Simon Glass <sjg@chromium.org> | 2020-02-03 07:36:07 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-02-05 19:33:46 -0700 |
commit | 02662480a88413eade86e271671108edecafd01d (patch) | |
tree | 15690067995434edfc7669d3754633e24aa11eb1 /drivers/sound | |
parent | 3062cd17af35b691582230c382dd125625d3b7ca (diff) | |
download | u-boot-02662480a88413eade86e271671108edecafd01d.tar.gz |
sandbox: sound: Handle errors better in sound_beep()
At present an error does not stop the sound-output loop. This is incorrect
since nothing can be gained by trying to continue. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/sound')
-rw-r--r-- | drivers/sound/sound-uclass.c | 5 |
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); |