[bug report] usb: gadget: R8A66597 peripheral controller support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Yoshihiro Shimoda,

The patch c41442474a26: "usb: gadget: R8A66597 peripheral controller
support." from Aug 19, 2009, leads to the following static checker
warning:

	drivers/usb/gadget/udc/r8a66597-udc.c:1942 r8a66597_probe()
	warn: integer overflow: (-1) * 2

drivers/usb/gadget/udc/r8a66597-udc.c
  1936          }
  1937          usb_ep_set_maxpacket_limit(&r8a66597->ep[0].ep, 64);
  1938          r8a66597->ep[0].pipenum = 0;
  1939          r8a66597->ep[0].fifoaddr = CFIFO;
  1940          r8a66597->ep[0].fifosel = CFIFOSEL;
  1941          r8a66597->ep[0].fifoctr = CFIFOCTR;
  1942          r8a66597->ep[0].pipectr = get_pipectr_addr(0);
                                          ^^^^^^^^^^^^^^^^^^^

#define get_pipectr_addr(pipenum) (M66592_PIPE1CTR + (pipenum - 1) * 2)

It's not normally valid to pass 0 to get_pipectr_addr() because it ends
up that we assign "r8a66597->ep[0].pipectr = M66592_PIPE1CTR - 2".

  1943          r8a66597->pipenum2ep[0] = &r8a66597->ep[0];
  1944          r8a66597->epaddr2ep[0] = &r8a66597->ep[0];
  1945  

Also:
        drivers/usb/gadget/udc/m66592-udc.c:1653 m66592_probe()
        warn: integer overflow: (-1) * 2

drivers/usb/gadget/udc/m66592-udc.c
  1647          usb_ep_set_maxpacket_limit(&m66592->ep[0].ep, 64);
  1648          m66592->ep[0].pipenum = 0;
  1649          m66592->ep[0].fifoaddr = M66592_CFIFO;
  1650          m66592->ep[0].fifosel = M66592_CFIFOSEL;
  1651          m66592->ep[0].fifoctr = M66592_CFIFOCTR;
  1652          m66592->ep[0].fifotrn = 0;
  1653          m66592->ep[0].pipectr = get_pipectr_addr(0);
  1654          m66592->pipenum2ep[0] = &m66592->ep[0];
  1655          m66592->epaddr2ep[0] = &m66592->ep[0];


regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux