Commit cf44a136 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: fireworks: Use safer way to arrange ring buffer pointer

To reverse a pointer for the ring buffer, subtraction by buffer
size is better than assignment to the beginning of the buffer.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c6e5e741
...@@ -58,7 +58,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained, ...@@ -58,7 +58,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained,
efw->pull_ptr += till_end; efw->pull_ptr += till_end;
if (efw->pull_ptr >= efw->resp_buf + if (efw->pull_ptr >= efw->resp_buf +
snd_efw_resp_buf_size) snd_efw_resp_buf_size)
efw->pull_ptr = efw->resp_buf; efw->pull_ptr -= snd_efw_resp_buf_size;
length -= till_end; length -= till_end;
buf += till_end; buf += till_end;
......
...@@ -148,7 +148,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode) ...@@ -148,7 +148,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode)
efw->push_ptr += till_end; efw->push_ptr += till_end;
if (efw->push_ptr >= efw->resp_buf + snd_efw_resp_buf_size) if (efw->push_ptr >= efw->resp_buf + snd_efw_resp_buf_size)
efw->push_ptr = efw->resp_buf; efw->push_ptr -= snd_efw_resp_buf_size;
length -= till_end; length -= till_end;
data += till_end; data += till_end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment