From: Eric Sesterhenn <[EMAIL PROTECTED]>

From: Eric Sesterhenn <[EMAIL PROTECTED]>

This fixes coverity Bug #390.

With the following code

        ret = ep->branch = balance(isp116x, ep->period, ep->load);
        if (ret < 0)
                goto fail;

the problem is that ret and balance are of the type int, and ep->branch is u16.
so the int balance() returns gets reduced to u16 and then converted to an int 
again,
which removes the sign. Maybe the following little c program can explain it 
better:
---
 drivers/usb/host/isp116x-hcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index e99210b..c5e2240 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -781,7 +781,7 @@ static int isp116x_urb_enqueue(struct us
                if (ep->branch < PERIODIC_SIZE)
                        break;
 
-               ret = ep->branch = balance(isp116x, ep->period, ep->load);
+               ep->branch = ret = balance(isp116x, ep->period, ep->load);
                if (ret < 0)
                        goto fail;
                ret = 0;
-- 
1.4.0


All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to