提交 800a85d3 编写于 作者: L Laurent Pinchart 提交者: Marek Szyprowski

mm: cma: Always consider a 0 base address reservation as dynamic

The fixed parameter to cma_declare_contiguous() tells the function
whether the given base address must be honoured or should be considered
as a hint only. The API considers a zero base address as meaning any
base address, which must never be considered as a fixed value.

Part of the implementation correctly checks both fixed and base != 0,
but two locations check the fixed value only. Set fixed to false when
base is 0 to fix that and simplify the code.
Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: NMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
上级 f022d8cb
...@@ -245,6 +245,9 @@ int __init cma_declare_contiguous(phys_addr_t base, ...@@ -245,6 +245,9 @@ int __init cma_declare_contiguous(phys_addr_t base,
size = ALIGN(size, alignment); size = ALIGN(size, alignment);
limit &= ~(alignment - 1); limit &= ~(alignment - 1);
if (!base)
fixed = false;
/* size should be aligned with order_per_bit */ /* size should be aligned with order_per_bit */
if (!IS_ALIGNED(size >> PAGE_SHIFT, 1 << order_per_bit)) if (!IS_ALIGNED(size >> PAGE_SHIFT, 1 << order_per_bit))
return -EINVAL; return -EINVAL;
...@@ -268,7 +271,7 @@ int __init cma_declare_contiguous(phys_addr_t base, ...@@ -268,7 +271,7 @@ int __init cma_declare_contiguous(phys_addr_t base,
} }
/* Reserve memory */ /* Reserve memory */
if (base && fixed) { if (fixed) {
if (memblock_is_region_reserved(base, size) || if (memblock_is_region_reserved(base, size) ||
memblock_reserve(base, size) < 0) { memblock_reserve(base, size) < 0) {
ret = -EBUSY; ret = -EBUSY;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册