[U-Boot] [PATCH RFC V1 10/18] usb: gadget: ether: return error from rx_submit if no request

Troy Kisky troy.kisky at boundarydevices.com
Tue Jul 16 22:47:38 CEST 2013


This prevents a crash if tftpboot is given a bad filename.

Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
---
 drivers/usb/gadget/ether.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index e39714b..1542ca3 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2401,7 +2401,8 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd)
 	}
 
 	packet_received = 0;
-	rx_submit(dev, dev->rx_req, 0);
+	if (dev->rx_req)
+		rx_submit(dev, dev->rx_req, 0);
 	return 0;
 fail:
 	return -1;
-- 
1.8.1.2



More information about the U-Boot mailing list