mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 18:13:26 -04:00
nfp: flower: use vmalloc_array() to simplify code
Remove array_size() calls and replace vmalloc() with vmalloc_array() in nfp_flower_metadata_init(). vmalloc_array() is also optimized better, resulting in less instructions being used. Place 'NFP_FL_STATS_ELEM_RS' with the sizeof() parameter as the second argument to vmalloc_array() to avoid -Wcalloc-transposed-args compilation warnings. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Link: https://patch.msgid.link/20250816090659.117699-3-rongqianfeng@vivo.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
4490d075c2
commit
fce214586f
@@ -564,8 +564,8 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count,
|
||||
|
||||
/* Init ring buffer and unallocated stats_ids. */
|
||||
priv->stats_ids.free_list.buf =
|
||||
vmalloc(array_size(NFP_FL_STATS_ELEM_RS,
|
||||
priv->stats_ring_size));
|
||||
vmalloc_array(priv->stats_ring_size,
|
||||
NFP_FL_STATS_ELEM_RS);
|
||||
if (!priv->stats_ids.free_list.buf)
|
||||
goto err_free_last_used;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user