usb: gadget: tegra: fix coverity issue
Sri Krishna chowdary [Sun, 14 Oct 2012 07:00:36 +0000 (12:00 +0530)]
name cant be NULL, it is static array.
Add check if name is empty string.

Bug 1046331

Change-Id: I2615ae0d24e44025b7528e10d0dafb124d355b4f
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/144374
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/usb/gadget/tegra_udc.c

index 80c7f94..deb4461 100644 (file)
@@ -1558,7 +1558,7 @@ static void udc_reset_ep_queue(struct tegra_udc *udc, u8 pipe)
 {
        struct tegra_ep *ep = get_ep_by_pipe(udc, pipe);
 
-       if (ep->name)
+       if (ep->name[0])
                nuke(ep, -ESHUTDOWN);
 }
 
@@ -2052,7 +2052,7 @@ static void dtd_complete_irq(struct tegra_udc *udc)
                curr_ep = get_ep_by_pipe(udc, i);
 
                /* If the ep is configured */
-               if (curr_ep->name == NULL) {
+               if (curr_ep->name[0] == '\0') {
                        WARNING("Invalid EP?");
                        continue;
                }