Skip to content

Commit 1337c39

Browse files
KubaTaba1ugapelwell
authored andcommitted
fix clang compilation error
1 parent 2e07105 commit 1337c39

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/dma-buf/heaps/system_heap.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@ static gfp_t order_flags[] = {HIGH_ORDER_GFP, HIGH_ORDER_GFP, LOW_ORDER_GFP};
5050
* to match with the sizes often found in IOMMUs. Using order 4 pages instead
5151
* of order 0 pages can significantly improve the performance of many IOMMUs
5252
* by reducing TLB pressure and time spent updating page tables.
53+
*
54+
* Note: `module_max_order` must be set explicitly instead of using
55+
* `orders[0]` to avoid Clang's "initializer element is not a
56+
* compile-time constant" error.
5357
*/
54-
static const unsigned int orders[] = {8, 4, 0};
58+
#define MAX_ORDERS_VALUE 8
59+
static const unsigned int orders[] = {MAX_ORDERS_VALUE, 4, 0};
5560
#define NUM_ORDERS ARRAY_SIZE(orders)
5661

57-
static unsigned int module_max_order = orders[0];
62+
static unsigned int module_max_order = MAX_ORDERS_VALUE;
5863

5964
module_param_named(max_order, module_max_order, uint, 0400);
6065
MODULE_PARM_DESC(max_order, "Maximum allocation order override.");

0 commit comments

Comments
 (0)