Merge branch 'fb' into devel
[pandora-kernel.git] / sound / oss / dmabuf.c
index b256c04..1e90d76 100644 (file)
@@ -25,6 +25,7 @@
 #define BE_CONSERVATIVE
 #define SAMPLE_ROUNDUP 0
 
+#include <linux/mm.h>
 #include "sound_config.h"
 
 #define DMAP_FREE_ON_CLOSE      0
@@ -794,9 +795,9 @@ static int find_output_space(int dev, char **buf, int *size)
 #ifdef BE_CONSERVATIVE
        active_offs = dmap->byte_counter + dmap->qhead * dmap->fragment_size;
 #else
-       active_offs = DMAbuf_get_buffer_pointer(dev, dmap, DMODE_OUTPUT);
+       active_offs = max(DMAbuf_get_buffer_pointer(dev, dmap, DMODE_OUTPUT), 0);
        /* Check for pointer wrapping situation */
-       if (active_offs < 0 || active_offs >= dmap->bytes_in_use)
+       if (active_offs >= dmap->bytes_in_use)
                active_offs = 0;
        active_offs += dmap->byte_counter;
 #endif