Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5C6D2D46B2 for ; Thu, 16 Oct 2025 07:26:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760599565; cv=none; b=dDbd9Xfa6iI/7MXnwMpsaTQFKplhUuaDQ7+3AF1J+qAjKkcPePWnPFCuAKuos1fZlKisW8oBsYsJszQBXGxs1S4+qimjc7RVftXqMLmOr6Vapy4Lot5P5ogqPmi44STPxDenSpixBuxV5X8dPYvbYWgp22BMSjG1J/MYWaJcbpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760599565; c=relaxed/simple; bh=sybAJFBCSgX05g0edVzHl+gxJZtDke+jlMEnnuVUKBw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=acZ/LIdroWY3ujy4MO+0FQhfl0kkwFKEE/ahKEE7DXSTo0XQ/0vQn5o0rjHifY+jZfD+Ygg6EJhnGsAifx8bzp8jL1BjZyNQv2ygT42d7dtjyLpUGGFMRW7ShBy+e+kJg2Chhb9zdRmgjvCrwWFSOGiprVEaqpEdiAkYYEA6t00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=nhdy/LOF; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="nhdy/LOF" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 367DB4E410F3; Thu, 16 Oct 2025 07:26:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id F17706062C; Thu, 16 Oct 2025 07:26:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id CC9F1102F22AA; Thu, 16 Oct 2025 09:25:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1760599560; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=FHZj/DgqA8o4wPCtAZaC2EX3z/hRb2lVa/qz3oUIQRY=; b=nhdy/LOFyku5r+RwonmgR91X0cHcHLcLhRrjVm5kKUxu2v9THrznH6afS9BZkAmFUncu5e OynM1Ju3DnbJRv+4/9sklTJe8eGxLry2C//BG8Tx9gI0VwR+h9dj/g2Jc1vBXmPz72yAPT 6qv3iHGKZCXL4h4MkZXL3CnZy/OoHw0cQ9v6KrvXwLeGCOZEPMx2Gu4PUcLFZSsuMBjnmT o7N6jWIXgY8nlfU5UbRkcvMvBh0J/dBvwgyYQDhVLrbAgMyjQfVGPKCPWsuWqo4K98x7Kg iAKm8zzQMXqzzPnarxCkuH8bn0lXohtGhpo6oJG/KQGm6/LXPiO3W1stqwijag== Message-ID: Date: Thu, 16 Oct 2025 09:25:55 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 4/5] net: stmmac: rearrange tc_init() To: "Russell King (Oracle)" , Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni References: From: Maxime Chevallier Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 On 15/10/2025 18:10, Russell King (Oracle) wrote: > 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 > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c > index 97e89a604abd..ef65cf511f3e 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)