ALSA: pcm - Fix hwptr buffer-size overlap bug

The fix 79452f0a28aa5a40522c487b42a5fc423647ad98 introduced another
bug due to the missing offset for the overlapped hwptr.
When the hwptr goes back to zero, the delta value has to be corrected
with the buffer size.  Otherwise this causes looping sounds.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index d315f72..72cfd47 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -256,7 +256,7 @@
 			delta = new_hw_ptr - hw_ptr_interrupt;
 	}
 	if (delta < 0) {
-		if (runtime->periods == 1)
+		if (runtime->periods == 1 || new_hw_ptr < old_hw_ptr)
 			delta += runtime->buffer_size;
 		if (delta < 0) {
 			hw_ptr_error(substream,