[PATCH 2/7] dfu: fix possible usage of uninitialized var

Lucas Stach dev at lynxeye.de
Mon Oct 20 11:15:56 PDT 2014


The error path would in fact use the status
variable without it being initialized first.

Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
 drivers/usb/gadget/dfu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c
index 67a0703..351b584 100644
--- a/drivers/usb/gadget/dfu.c
+++ b/drivers/usb/gadget/dfu.c
@@ -207,6 +207,7 @@ dfu_bind(struct usb_configuration *c, struct usb_function *f)
 	dfu->dnreq = usb_ep_alloc_request(c->cdev->gadget->ep0);
 	if (!dfu->dnreq) {
 		printf("usb_ep_alloc_request failed\n");
+		status = -ENOMEM;
 		goto out;
 	}
 	dfu->dnreq->buf = dma_alloc(CONFIG_USBD_DFU_XFER_SIZE);
-- 
1.9.3




More information about the barebox mailing list