From 1337c39626c14ca5e61b4cddbc097d87212a0b13 Mon Sep 17 00:00:00 2001 From: KubaTaba1uga Date: Mon, 3 Mar 2025 17:25:29 +0100 Subject: [PATCH] fix clang compilation error --- drivers/dma-buf/heaps/system_heap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/dma-buf/heaps/system_heap.c +++ b/drivers/dma-buf/heaps/system_heap.c @@ -50,11 +50,16 @@ static gfp_t order_flags[] = {HIGH_ORDER * to match with the sizes often found in IOMMUs. Using order 4 pages instead * of order 0 pages can significantly improve the performance of many IOMMUs * by reducing TLB pressure and time spent updating page tables. + * + * Note: `module_max_order` must be set explicitly instead of using + * `orders[0]` to avoid Clang's "initializer element is not a + * compile-time constant" error. */ -static const unsigned int orders[] = {8, 4, 0}; +#define MAX_ORDERS_VALUE 8 +static const unsigned int orders[] = {MAX_ORDERS_VALUE, 4, 0}; #define NUM_ORDERS ARRAY_SIZE(orders) -static unsigned int module_max_order = orders[0]; +static unsigned int module_max_order = MAX_ORDERS_VALUE; module_param_named(max_order, module_max_order, uint, 0400); MODULE_PARM_DESC(max_order, "Maximum allocation order override.");