From: Simon Glass Date: Thu, 15 Nov 2018 19:56:12 -0700 Subject: [U-Boot] [PATCH 1/4] sound: Correct data output in sound_create_square_wave() In-Reply-To: <20181116025615.221806-1-sjg@chromium.org> References: <20181116025615.221806-1-sjg@chromium.org> Message-ID: <20181116025615.221806-2-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This function currently outputs twice as much data as it should and overwrites its buffer as a result. Fix it. Signed-off-by: Simon Glass --- drivers/sound/sound.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c index 969408186fd..6c1eb4c19cc 100644 --- a/drivers/sound/sound.c +++ b/drivers/sound/sound.c @@ -25,12 +25,10 @@ void sound_create_square_wave(unsigned short *data, int size, uint32_t freq) for (i = 0; size && i < half; i++) { size -= 2; *data++ = amplitude; - *data++ = amplitude; } for (i = 0; size && i < period - half; i++) { size -= 2; *data++ = -amplitude; - *data++ = -amplitude; } } } -- 2.19.1.1215.g8438c0b245-goog