diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-01-20 10:03:45 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-09 09:37:03 +0100 |
commit | 2b9bcff79a02f770fa730e2689ba35cc03c0da7d (patch) | |
tree | a72b52a9e256fecb01d1a1d69acb6359343cff20 /include/usb | |
parent | 25fd64ed22b56b875c3f8d8bffd737a38084cf96 (diff) | |
download | barebox-2b9bcff79a02f770fa730e2689ba35cc03c0da7d.tar.gz barebox-2b9bcff79a02f770fa730e2689ba35cc03c0da7d.tar.xz |
usb: gadget: properly release f_multi_opts
The usbgadget commands uses statically allocated f_multi_opts and passes
this to usb_multi_register(). These f_multi_opts are of course no
longer valid when we leave the usbgadget command. Luckily we do not use
the data after we left the usbgadget command, so this never has been a
problem. However, f_multi_opts has some allocated members which we can
not free anymore on gadget unregistration because we no longer have the
pointer to them.
Fix this by adding a release function to struct f_multi_opts. This way
we can allocate all memory dynamically and properly free it when not
used anymore.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb')
-rw-r--r-- | include/usb/gadget-multi.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/usb/gadget-multi.h b/include/usb/gadget-multi.h index 5ca462326a..81beddc7cf 100644 --- a/include/usb/gadget-multi.h +++ b/include/usb/gadget-multi.h @@ -9,9 +9,11 @@ struct f_multi_opts { struct f_fastboot_opts fastboot_opts; struct f_dfu_opts dfu_opts; int create_acm; + void (*release)(struct f_multi_opts *opts); }; int usb_multi_register(struct f_multi_opts *opts); void usb_multi_unregister(void); +void usb_multi_opts_release(struct f_multi_opts *opts); #endif /* __USB_GADGET_MULTI_H */ |