diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-01-18 18:57:06 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-02-12 10:24:32 -0500 |
commit | e8faf2f2adeb9066de3c968a57803bb262f61ee1 (patch) | |
tree | 130c2e3d904da7876ac88ea089f85f48cab5e313 /firmware/usbstack/usb_storage.c | |
parent | 95dfc489b5a602f68202b206c434f8485e9d3915 (diff) | |
download | rockbox-e8faf2f2adeb9066de3c968a57803bb262f61ee1.tar.gz rockbox-e8faf2f2adeb9066de3c968a57803bb262f61ee1.zip |
buflib: add a common dummy callbacks struct & use it
There are various allocations that can't be moved or shrunk.
Provide a global callback struct for this use case instead of
making each caller declare its own dummy struct.
Also fixed ROLO and x1000 installer code which incorrectly
used movable allocations.
Change-Id: I00088396b9826e02e69a4a33477fe1a7816374f1
Diffstat (limited to 'firmware/usbstack/usb_storage.c')
-rw-r--r-- | firmware/usbstack/usb_storage.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index a32cf185e7..eb82f72eae 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c | |||
@@ -449,12 +449,11 @@ void usb_storage_init_connection(void) | |||
449 | #endif | 449 | #endif |
450 | #else | 450 | #else |
451 | unsigned char * buffer; | 451 | unsigned char * buffer; |
452 | /* dummy ops with no callbacks, needed because by | ||
453 | * default buflib buffers can be moved around which must be avoided */ | ||
454 | static struct buflib_callbacks dummy_ops; | ||
455 | 452 | ||
456 | // Add 31 to handle worst-case misalignment | 453 | // Add 31 to handle worst-case misalignment |
457 | usb_handle = core_alloc_ex("usb storage", ALLOCATE_BUFFER_SIZE + MAX_CBW_SIZE + 31, &dummy_ops); | 454 | usb_handle = core_alloc_ex("usb storage", |
455 | ALLOCATE_BUFFER_SIZE + MAX_CBW_SIZE + 31, | ||
456 | &buflib_ops_locked); | ||
458 | if (usb_handle < 0) | 457 | if (usb_handle < 0) |
459 | panicf("%s(): OOM", __func__); | 458 | panicf("%s(): OOM", __func__); |
460 | 459 | ||