-
Notifications
You must be signed in to change notification settings - Fork 349
Part 1 of userspace DP subset PR #10302 #10350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1df93bc
9b9132e
a564dc5
90ef190
4fbccef
aa4d87f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -71,3 +71,14 @@ int heap_info(int index, struct mm_info *out) | |||||
| return 0; | ||||||
| } | ||||||
| #endif | ||||||
|
|
||||||
| void *sof_heap_alloc(struct k_heap *heap, uint32_t flags, size_t bytes, | ||||||
| size_t alignment) | ||||||
| { | ||||||
| return malloc(bytes); | ||||||
|
||||||
| return malloc(bytes); | |
| return aligned_alloc(alignment, bytes); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -48,6 +48,17 @@ void *rbrealloc_align(void *ptr, uint32_t flags, size_t bytes, | |||||||||||||||||
| return realloc(ptr, bytes); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| void *sof_heap_alloc(struct k_heap *heap, uint32_t flags, size_t bytes, | ||||||||||||||||||
| size_t alignment) | ||||||||||||||||||
| { | ||||||||||||||||||
| return malloc(bytes); | ||||||||||||||||||
|
||||||||||||||||||
| return malloc(bytes); | |
| /* Use aligned_alloc to respect the alignment parameter. | |
| * Note: aligned_alloc requires that bytes is a multiple of alignment. | |
| */ | |
| if (alignment && (bytes % alignment != 0)) { | |
| bytes = ((bytes + alignment - 1) / alignment) * alignment; | |
| } | |
| return aligned_alloc(alignment ? alignment : sizeof(void *), bytes); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,10 +102,12 @@ void WEAK *mod_balloc_align(struct processing_module *mod, size_t size, size_t a | |
| return ret; | ||
| } | ||
|
|
||
| void WEAK *mod_alloc_align(struct processing_module *mod, size_t size, size_t alignment) | ||
| void WEAK *mod_alloc_ext(struct processing_module *mod, uint32_t flags, size_t size, | ||
| size_t alignment) | ||
| { | ||
| void *ret; | ||
| (void)mod; | ||
| (void)flags; | ||
| (void)alignment; | ||
|
|
||
| ret = malloc(size); | ||
|
|
@@ -122,6 +124,23 @@ int WEAK mod_free(struct processing_module *mod, const void *ptr) | |
| return 0; | ||
| } | ||
|
|
||
| void WEAK *sof_heap_alloc(struct k_heap *heap, uint32_t flags, size_t bytes, | ||
| size_t alignment) | ||
| { | ||
| (void)heap; | ||
| (void)flags; | ||
| (void)alignment; | ||
|
|
||
| return malloc(bytes); | ||
| } | ||
|
Comment on lines
+127
to
+135
|
||
|
|
||
| void WEAK sof_heap_free(struct k_heap *heap, void *addr) | ||
| { | ||
| (void)heap; | ||
|
|
||
| free(addr); | ||
| } | ||
|
|
||
| int WEAK memcpy_s(void *dest, size_t dest_size, | ||
| const void *src, size_t count) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you consider moving the code from the 'err' label to this location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm usually all for "early returns," i.e. for
instead of
but if there's some cleanup to be done in (all) error cases, I usually prefer a
goto. When there's only one error case - well, that's a grey zone for me... But since we're likely to extend this function in the future, I'd rather keep it this way.