Merge branch 'fix/misc' into topic/misc
[safe/jmp/linux-2.6] / sound / oss / dmabuf.c
index eaf6997..1bfcf7e 100644 (file)
@@ -439,7 +439,7 @@ int DMAbuf_sync(int dev)
                        DMAbuf_launch_output(dev, dmap);
                adev->dmap_out->flags |= DMA_SYNCING;
                adev->dmap_out->underrun_count = 0;
-               while (!signal_pending(current) && n++ <= adev->dmap_out->nbufs && 
+               while (!signal_pending(current) && n++ < adev->dmap_out->nbufs &&
                       adev->dmap_out->qlen && adev->dmap_out->underrun_count == 0) {
                        long t = dmabuf_timeout(dmap);
                        spin_unlock_irqrestore(&dmap->lock,flags);
@@ -795,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