Skip to content

Commit

Permalink
drivers/mediatek/afe: Handle zero-length allocation
Browse files Browse the repository at this point in the history
The older SOF allocator would return a valid pointer into the heap for
a zero length block, but Zephyr's sys_heap returns a NULL.  That's not
an error and it will free() as a noop.

Signed-off-by: Andy Ross <andyross@google.com>
  • Loading branch information
andyross committed Dec 18, 2024
1 parent e66e6c4 commit 48744c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/drivers/mediatek/afe/afe-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ int afe_probe(struct mtk_base_afe *afe)
afe->irqs_size = platform->irqs_size;
afe->irqs = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM,
sizeof(struct mtk_base_afe_irq) * afe->irqs_size);
if (!afe->irqs)
if (!afe->irqs && afe->irqs_size)
goto err_alloc_dais;

for (i = 0; i < afe->irqs_size; i++)
Expand Down

0 comments on commit 48744c6

Please sign in to comment.