History

dma-coherent: use KiB in DMA allocation logs

Update DMA reserved memory pool allocation log messages to display sizes in KiB instead of MiB. Using MiB caused allocations less than 1 MiB to be logged as 0 MiB due to integer truncation. KiB provides better precision for smaller memory regions specified in the Device Tree.

Vova Sharaienko committed 4 months ago

Commit dbcc3cd1 parent 9db11c61 file · +4 −4Browse files

Unified · Split

kernel/dma/coherent.c+4−4
@@ -69,8 +69,8 @@ out_free_dma_mem: · 68 unmodified lines
6969 kfree(dma_mem);
7070 out_unmap_membase:
7171 memunmap(mem_base);
72− pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %zd MiB\n",
73− &phys_addr, size / SZ_1M);
72+ pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %zu KiB\n",
73+ &phys_addr, size / SZ_1K);
7474 return ERR_PTR(-ENOMEM);
7575 }
7676
@@ -384,8 +384,8 @@ static int __init rmem_dma_setup(unsigned long node, struct reserved_mem *rmem) · 307 unmodified lines
384384 }
385385 #endif
386386
387− pr_info("Reserved memory: created DMA memory pool at %pa, size %ld MiB\n",
388− &rmem->base, (unsigned long)rmem->size / SZ_1M);
387+ pr_info("Reserved memory: created DMA memory pool at %pa, size %llu KiB\n",
388+ &rmem->base, (unsigned long long)(rmem->size / SZ_1K));
389389 return 0;
390390 }
391391

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t