From 25e67cbb2fce8690bcde07598ad4998aad475f13 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Mon, 25 Sep 2017 12:02:35 +0200 Subject: remove checks for xzalloc() returning NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- drivers/usb/gadget/pxa27x_udc.c | 2 -- drivers/usb/musb/musb_host.c | 2 -- drivers/usb/musb/phy-am335x-control.c | 4 ---- drivers/usb/musb/phy-am335x.c | 2 -- 4 files changed, 10 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 372c07b418..4e6b858868 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c @@ -218,8 +218,6 @@ static struct usb_request *pxa_ep_alloc_request(struct usb_ep *_ep) struct pxa27x_request *req; req = xzalloc(sizeof *req); - if (!req) - return NULL; INIT_LIST_HEAD(&req->queue); req->in_use = 0; diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 32a8f06529..68d819af2c 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -1717,8 +1717,6 @@ int musb_host_alloc(struct musb *musb) { /* usbcore sets dev->driver_data to hcd, and sometimes uses that... */ musb->hcd = xzalloc(sizeof(struct usb_hcd)); - if (!musb->hcd) - return -EINVAL; musb->hcd->hcd_priv = musb; diff --git a/drivers/usb/musb/phy-am335x-control.c b/drivers/usb/musb/phy-am335x-control.c index 5fd8802b3a..55a2ed27b7 100644 --- a/drivers/usb/musb/phy-am335x-control.c +++ b/drivers/usb/musb/phy-am335x-control.c @@ -140,10 +140,6 @@ static int am335x_control_usb_probe(struct device_d *dev) return ret; ctrl_usb = xzalloc(sizeof(*ctrl_usb)); - if (!ctrl_usb) { - dev_err(dev, "unable to alloc memory for control usb\n"); - return -ENOMEM; - } ctrl_usb->dev = dev; diff --git a/drivers/usb/musb/phy-am335x.c b/drivers/usb/musb/phy-am335x.c index 204e51054d..ec8c0f538b 100644 --- a/drivers/usb/musb/phy-am335x.c +++ b/drivers/usb/musb/phy-am335x.c @@ -34,8 +34,6 @@ static int am335x_phy_probe(struct device_d *dev) int ret; am_usbphy = xzalloc(sizeof(*am_usbphy)); - if (!am_usbphy) - return -ENOMEM; iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) { -- cgit v1.2.3