9
0
Fork 0

usb: dfu: fix error path to avoid NULL ptr deref

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Lucas Stach 2014-02-07 09:48:51 +01:00 committed by Sascha Hauer
parent c26a451721
commit 259b65b5ac
1 changed files with 3 additions and 1 deletions

View File

@ -597,8 +597,10 @@ static int dfu_bind_config(struct usb_configuration *c)
func->disable = dfu_disable;
dfu->dnreq = usb_ep_alloc_request(c->cdev->gadget->ep0);
if (!dfu->dnreq)
if (!dfu->dnreq) {
printf("usb_ep_alloc_request failed\n");
goto out;
}
dfu->dnreq->buf = dma_alloc(CONFIG_USBD_DFU_XFER_SIZE);
dfu->dnreq->complete = dn_complete;
dfu->dnreq->zero = 0;