Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

octeontx2-pf: Add check for devm_kcalloc

As the devm_kcalloc may return NULL pointer,
it should be better to add check for the return
value, as same as the others.

Fixes: e8e095b3b370 ("octeontx2-af: cn10k: Bandwidth profiles config support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/20221122055449.31247-1-jiasheng@iscas.ac.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Jiasheng Jiang and committed by
Paolo Abeni
cd07eadd 290b5fe0

+2
+2
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
··· 4985 4985 ipolicer->ref_count = devm_kcalloc(rvu->dev, 4986 4986 ipolicer->band_prof.max, 4987 4987 sizeof(u16), GFP_KERNEL); 4988 + if (!ipolicer->ref_count) 4989 + return -ENOMEM; 4988 4990 } 4989 4991 4990 4992 /* Set policer timeunit to 2us ie (19 + 1) * 100 nsec = 2us */