mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-29 15:43:44 +08:00
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>
This commit is contained in:
parent
3062cd17af
commit
02662480a8
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user