From 8c438208c1629b9929ee7818c192fe492eb13fe1 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Sat, 22 Aug 2009 19:32:44 +0200 Subject: [PATCH] --- yaml --- r: 162531 b: refs/heads/master c: 48c8276d7ac534d62c594c9a493130ff9137675d h: refs/heads/master i: 162529: 9a5132e86496a01655195347298cee5f908f018d 162527: 6614c86ac76a6d90f24e99891d4e0fef227fcfc8 v: v3 --- [refs] | 2 +- trunk/drivers/staging/rspiusb/rspiusb.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 4585aee3f643..30cd31eee95f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 77943d31b7dfdbd1ad58d49bd16ae6e7601bcd6c +refs/heads/master: 48c8276d7ac534d62c594c9a493130ff9137675d diff --git a/trunk/drivers/staging/rspiusb/rspiusb.c b/trunk/drivers/staging/rspiusb/rspiusb.c index 04e2f92c0f62..0495fbfe59d9 100644 --- a/trunk/drivers/staging/rspiusb/rspiusb.c +++ b/trunk/drivers/staging/rspiusb/rspiusb.c @@ -611,6 +611,7 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx) int i = 0; int k = 0; int err = 0; + int ret; struct page **maplist_p; int numPagesRequired; @@ -687,9 +688,16 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx) } else { pdx->sgl[frameInfo][0].length = count; } - pdx->sgEntries[frameInfo] = - usb_buffer_map_sg(pdx->udev, epAddr, pdx->sgl[frameInfo], - pdx->maplist_numPagesMapped[frameInfo]); + ret = usb_buffer_map_sg(pdx->udev, epAddr, pdx->sgl[frameInfo], + pdx->maplist_numPagesMapped[frameInfo]); + if (ret < 0) { + vfree(maplist_p); + dbg("usb_buffer_map_sg() failed"); + return -EINVAL; + } + + pdx->sgEntries[frameInfo] = ret; + dbg("number of sgEntries = %d", pdx->sgEntries[frameInfo]); pdx->userBufMapped = 1; vfree(maplist_p); @@ -716,8 +724,6 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx) pdx->PixelUrb[frameInfo][i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT; } - if (i == 0) - return -EINVAL; /* only interrupt when last URB completes */ pdx->PixelUrb[frameInfo][--i]->transfer_flags &= ~URB_NO_INTERRUPT; pdx->pendedPixelUrbs[frameInfo] =