usb: gadget: udc: fsl_qe_udc: don't print on ENOMEM
authorWolfram Sang <wsa-dev@sang-engineering.com>
Thu, 25 Aug 2016 17:39:03 +0000 (19:39 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 29 Aug 2016 07:47:47 +0000 (10:47 +0300)
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/fsl_qe_udc.c

index cf8819a..9d6b2c8 100644 (file)
@@ -421,10 +421,8 @@ static int qe_ep_rxbd_update(struct qe_ep *ep)
        bd = ep->rxbase;
 
        ep->rxframe = kmalloc(sizeof(*ep->rxframe), GFP_ATOMIC);
        bd = ep->rxbase;
 
        ep->rxframe = kmalloc(sizeof(*ep->rxframe), GFP_ATOMIC);
-       if (ep->rxframe == NULL) {
-               dev_err(ep->udc->dev, "malloc rxframe failed\n");
+       if (!ep->rxframe)
                return -ENOMEM;
                return -ENOMEM;
-       }
 
        qe_frame_init(ep->rxframe);
 
 
        qe_frame_init(ep->rxframe);
 
@@ -435,9 +433,7 @@ static int qe_ep_rxbd_update(struct qe_ep *ep)
 
        size = (ep->ep.maxpacket + USB_CRC_SIZE + 2) * (bdring_len + 1);
        ep->rxbuffer = kzalloc(size, GFP_ATOMIC);
 
        size = (ep->ep.maxpacket + USB_CRC_SIZE + 2) * (bdring_len + 1);
        ep->rxbuffer = kzalloc(size, GFP_ATOMIC);
-       if (ep->rxbuffer == NULL) {
-               dev_err(ep->udc->dev, "malloc rxbuffer failed,size=%d\n",
-                               size);
+       if (!ep->rxbuffer) {
                kfree(ep->rxframe);
                return -ENOMEM;
        }
                kfree(ep->rxframe);
                return -ENOMEM;
        }
@@ -668,10 +664,8 @@ static int qe_ep_init(struct qe_udc *udc,
 
        if ((ep->tm == USBP_TM_CTL) || (ep->dir == USB_DIR_IN)) {
                ep->txframe = kmalloc(sizeof(*ep->txframe), GFP_ATOMIC);
 
        if ((ep->tm == USBP_TM_CTL) || (ep->dir == USB_DIR_IN)) {
                ep->txframe = kmalloc(sizeof(*ep->txframe), GFP_ATOMIC);
-               if (ep->txframe == NULL) {
-                       dev_err(udc->dev, "malloc txframe failed\n");
+               if (!ep->txframe)
                        goto en_done2;
                        goto en_done2;
-               }
                qe_frame_init(ep->txframe);
        }
 
                qe_frame_init(ep->txframe);
        }
 
@@ -2347,10 +2341,8 @@ static struct qe_udc *qe_udc_config(struct platform_device *ofdev)
        u32 offset;
 
        udc = kzalloc(sizeof(*udc), GFP_KERNEL);
        u32 offset;
 
        udc = kzalloc(sizeof(*udc), GFP_KERNEL);
-       if (udc == NULL) {
-               dev_err(&ofdev->dev, "malloc udc failed\n");
+       if (!udc)
                goto cleanup;
                goto cleanup;
-       }
 
        udc->dev = &ofdev->dev;
 
 
        udc->dev = &ofdev->dev;