Skip to content

Commit 5ded9f3

Browse files
committed
drivers/mediatek/afe: Handle zero-length allocation
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>
1 parent 0c04f0d commit 5ded9f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/drivers/mediatek/afe/afe-drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ int afe_probe(struct mtk_base_afe *afe)
380380
afe->irqs_size = platform->irqs_size;
381381
afe->irqs = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM,
382382
sizeof(struct mtk_base_afe_irq) * afe->irqs_size);
383-
if (!afe->irqs)
383+
if (!afe->irqs && afe->irqs_size)
384384
goto err_alloc_dais;
385385

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

0 commit comments

Comments
 (0)