@@ -2488,21 +2488,21 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
2488
2488
* modification to the CBM if the default does not satisfy the
2489
2489
* requirements.
2490
2490
*/
2491
- static void cbm_ensure_valid (u32 * _val , struct rdt_resource * r )
2491
+ static u32 cbm_ensure_valid (u32 _val , struct rdt_resource * r )
2492
2492
{
2493
- unsigned long val = * _val ;
2494
2493
unsigned int cbm_len = r -> cache .cbm_len ;
2495
2494
unsigned long first_bit , zero_bit ;
2495
+ unsigned long val = _val ;
2496
2496
2497
- if (val == 0 )
2498
- return ;
2497
+ if (! val )
2498
+ return 0 ;
2499
2499
2500
2500
first_bit = find_first_bit (& val , cbm_len );
2501
2501
zero_bit = find_next_zero_bit (& val , cbm_len , first_bit );
2502
2502
2503
2503
/* Clear any remaining bits to ensure contiguous region */
2504
2504
bitmap_clear (& val , zero_bit , cbm_len - zero_bit );
2505
- * _val = (u32 )val ;
2505
+ return (u32 )val ;
2506
2506
}
2507
2507
2508
2508
/*
@@ -2560,7 +2560,7 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct rdt_resource *r,
2560
2560
* Force the initial CBM to be valid, user can
2561
2561
* modify the CBM based on system availability.
2562
2562
*/
2563
- cbm_ensure_valid (& d -> new_ctrl , r );
2563
+ d -> new_ctrl = cbm_ensure_valid (d -> new_ctrl , r );
2564
2564
/*
2565
2565
* Assign the u32 CBM to an unsigned long to ensure that
2566
2566
* bitmap_weight() does not access out-of-bound memory.
0 commit comments