Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
1df93bc9b9132ea564dc590ef1904fbccefaa4d87fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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); | ||||||
CopilotAI | ||||||
| returnmalloc(bytes); | |
| returnaligned_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); | ||||||||||||||||||
CopilotAI | ||||||||||||||||||
| returnmalloc(bytes); | |
| /*Usealigned_alloctorespectthealignmentparameter. | |
| *Note: aligned_allocrequiresthatbytesisamultipleofalignment. | |
| */ | |
| if (alignment&& (bytes % alignment!=0)) { | |
| bytes= ((bytes+alignment-1) / alignment) *alignment; | |
| } | |
| returnaligned_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
CopilotAI | ||
| 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) | ||
| { | ||
Uh oh!
There was an error while loading. Please reload this page.
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.