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
69 kfree(dma_mem);69 kfree(dma_mem);
70out_unmap_membase:70out_unmap_membase:
71 memunmap(mem_base);71 memunmap(mem_base);
72 pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %zd MiB\n",72 pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %zu KiB\n",
73 &phys_addr, size / SZ_1M);73 &phys_addr, size / SZ_1K);
74 return ERR_PTR(-ENOMEM);74 return ERR_PTR(-ENOMEM);
75}75}
76 76
@@ -384,8 +384,8 @@ static int __init rmem_dma_setup(unsigned long node, struct reserved_mem *rmem) · 307 unmodified lines
384 }384 }
385#endif385#endif
386 386
387 pr_info("Reserved memory: created DMA memory pool at %pa, size %ld MiB\n",387 pr_info("Reserved memory: created DMA memory pool at %pa, size %llu KiB\n",
388 &rmem->base, (unsigned long)rmem->size / SZ_1M);388 &rmem->base, (unsigned long long)(rmem->size / SZ_1K));
389 return 0;389 return 0;
390}390}
391 391

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