From: Russell King (Oracle) Date: Wed, 15 Oct 2025 16:10:56 +0000 (+0100) Subject: net: stmmac: rearrange tc_init() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=07d91ec99a8a37d9b9f6d8ec3f16b97622a74893;p=thirdparty%2Fkernel%2Flinux.git net: stmmac: rearrange tc_init() To make future changes easier, rearrange the use of dma_cap->l3l4fnum vs priv->flow_entries_max. Always initialise priv->flow_entries_max from dma_cap->l3l4fnum, then use priv->flow_entries_max to determine whether we allocate priv->flow_entries and set it up. This change is safe because tc_init() is only called once from stmmac_dvr_probe(). Signed-off-by: Russell King (Oracle) Reviewed-by: Maxime Chevallier Link: https://patch.msgid.link/E1v945Y-0000000Ameb-2gDI@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 97e89a604abd7..ef65cf511f3e2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -262,10 +262,10 @@ static int tc_init(struct stmmac_priv *priv) unsigned int count; int ret, i; - if (dma_cap->l3l4fnum) { - priv->flow_entries_max = dma_cap->l3l4fnum; + priv->flow_entries_max = dma_cap->l3l4fnum; + if (priv->flow_entries_max) { priv->flow_entries = devm_kcalloc(priv->device, - dma_cap->l3l4fnum, + priv->flow_entries_max, sizeof(*priv->flow_entries), GFP_KERNEL); if (!priv->flow_entries)