Skip to content

Commit 6f1188b

Browse files
Yue Hurobherring
authored andcommitted
of: reserved-memory: remove duplicated call to of_get_flat_dt_prop() for no-map node
Just use nomap instead of the second call to of_get_flat_dt_prop(). And change nomap as a bool type due to != NULL operator. Also, correct comment about node of 'align' -> 'alignment'. Signed-off-by: Yue Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent bda2127 commit 6f1188b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/of/of_reserved_mem.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname,
6969

7070
/**
7171
* __reserved_mem_alloc_size() - allocate reserved memory described by
72-
* 'size', 'align' and 'alloc-ranges' properties.
72+
* 'size', 'alignment' and 'alloc-ranges' properties.
7373
*/
7474
static int __init __reserved_mem_alloc_size(unsigned long node,
7575
const char *uname, phys_addr_t *res_base, phys_addr_t *res_size)
@@ -79,7 +79,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
7979
phys_addr_t base = 0, align = 0, size;
8080
int len;
8181
const __be32 *prop;
82-
int nomap;
82+
bool nomap;
8383
int ret;
8484

8585
prop = of_get_flat_dt_prop(node, "size", &len);
@@ -92,8 +92,6 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
9292
}
9393
size = dt_mem_next_cell(dt_root_size_cells, &prop);
9494

95-
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
96-
9795
prop = of_get_flat_dt_prop(node, "alignment", &len);
9896
if (prop) {
9997
if (len != dt_root_addr_cells * sizeof(__be32)) {
@@ -104,11 +102,13 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
104102
align = dt_mem_next_cell(dt_root_addr_cells, &prop);
105103
}
106104

105+
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
106+
107107
/* Need adjust the alignment to satisfy the CMA requirement */
108108
if (IS_ENABLED(CONFIG_CMA)
109109
&& of_flat_dt_is_compatible(node, "shared-dma-pool")
110110
&& of_get_flat_dt_prop(node, "reusable", NULL)
111-
&& !of_get_flat_dt_prop(node, "no-map", NULL)) {
111+
&& !nomap) {
112112
unsigned long order =
113113
max_t(unsigned long, MAX_ORDER - 1, pageblock_order);
114114

@@ -247,7 +247,7 @@ void __init fdt_init_reserved_mem(void)
247247
int len;
248248
const __be32 *prop;
249249
int err = 0;
250-
int nomap;
250+
bool nomap;
251251

252252
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
253253
prop = of_get_flat_dt_prop(node, "phandle", &len);

0 commit comments

Comments
 (0)