public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] driver: gadget: fastboot: Link endpoint and descriptors
@ 2021-09-16  7:02 qianfanguijin
  2021-11-03 16:53 ` Sean Anderson
  0 siblings, 1 reply; 5+ messages in thread
From: qianfanguijin @ 2021-09-16  7:02 UTC (permalink / raw)
  To: u-boot; +Cc: lukma, marex, peter.chen, jun.li, peng.fan, qianfan Zhao

From: qianfan Zhao <qianfanguijin@163.com>

If the downloading file size is equal to the partition size, "fastboot
flash" can't work, at least in sunxi platform, because used an
uninitalized point: ep->desc.

Reproduce: fastboot flash loader1 spl/sunxi-spl.bin.

Fix it.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
 drivers/usb/gadget/f_fastboot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 8ba55aab9f..45bb3aba66 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -319,13 +319,13 @@ static int fastboot_set_alt(struct usb_function *f,
 	struct usb_composite_dev *cdev = f->config->cdev;
 	struct usb_gadget *gadget = cdev->gadget;
 	struct f_fastboot *f_fb = func_to_fastboot(f);
-	const struct usb_endpoint_descriptor *d;
 
 	debug("%s: func: %s intf: %d alt: %d\n",
 	      __func__, f->name, interface, alt);
 
-	d = fb_ep_desc(gadget, &fs_ep_out, &hs_ep_out, &ss_ep_out);
-	ret = usb_ep_enable(f_fb->out_ep, d);
+	f_fb->out_ep->desc = fb_ep_desc(gadget, &fs_ep_out, &hs_ep_out,
+					&ss_ep_out);
+	ret = usb_ep_enable(f_fb->out_ep, f_fb->out_ep->desc);
 	if (ret) {
 		puts("failed to enable out ep\n");
 		return ret;
@@ -339,8 +339,8 @@ static int fastboot_set_alt(struct usb_function *f,
 	}
 	f_fb->out_req->complete = rx_handler_command;
 
-	d = fb_ep_desc(gadget, &fs_ep_in, &hs_ep_in, &ss_ep_in);
-	ret = usb_ep_enable(f_fb->in_ep, d);
+	f_fb->in_ep->desc = fb_ep_desc(gadget, &fs_ep_in, &hs_ep_in, &ss_ep_in);
+	ret = usb_ep_enable(f_fb->in_ep, f_fb->in_ep->desc);
 	if (ret) {
 		puts("failed to enable in ep\n");
 		goto err;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-15  5:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <tencent_81D5019A2AD62FD144C688D4716A817C2608@qq.com>
2021-11-05  6:28 ` [PATCH] driver: gadget: fastboot: Link endpoint and descriptors qianfan
2021-11-05 13:29   ` Sean Anderson
2021-11-15  5:51     ` qianfan
2021-09-16  7:02 qianfanguijin
2021-11-03 16:53 ` Sean Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox