X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=sound%2Foss%2Fdmabuf.c;h=1e90d769b62e3ef63181f809a5ccd36e819d126b;hb=b98f5046397b9f4c5060e5b73e483bfd9e453dd6;hp=b256c0401161a8ad97c1c5dd680291b907fe284f;hpb=4a61f17378c2cdd9bd8f34ef8bd7422861d0c1f1;p=linux-2.6-omap-h63xx.git diff --git a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c index b256c040116..1e90d769b62 100644 --- a/sound/oss/dmabuf.c +++ b/sound/oss/dmabuf.c @@ -25,6 +25,7 @@ #define BE_CONSERVATIVE #define SAMPLE_ROUNDUP 0 +#include #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