From 98caed39c1db002b2c34b8040ab765c5fa9c6675 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Thu, 29 Oct 2026 11:33:55 +0100 Subject: [PATCH] net: stmmac: initialize est_lock at probe time priv->est is allocated with devm_kzalloc() on the first TAPRIO REPLACE and priv->est_lock is initialized in the same place, which ties the validity of the lock to whether TAPRIO has ever been configured. The lock is also never destroyed. Initialize priv->est_lock in __stmmac_dvr_probe() next to priv->lock and destroy it in stmmac_dvr_remove(). This keeps the lock valid for the entire lifetime of the device, independent of the TAPRIO state, and removes the lazy initialization from the TAPRIO configuration path. No functional change intended. Reviewed-by: Maxime Chevallier Signed-off-by: Lorenzo Bianconi Link: https://patch.msgid.link/20261029-stmmac-est-fixes-v5-1-85b830a795a9@oss.qualcomm.com Signed-off-by: Paolo Abeni --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b038472b9817..aacc56974409 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -8236,6 +8236,7 @@ static int __stmmac_dvr_probe(struct device *device, stmmac_napi_add(ndev); mutex_init(&priv->lock); + mutex_init(&priv->est_lock); rwlock_init(&priv->ptp_lock); stmmac_fpe_init(priv); @@ -8369,6 +8370,7 @@ void stmmac_dvr_remove(struct device *dev) destroy_workqueue(priv->wq); mutex_destroy(&priv->lock); + mutex_destroy(&priv->est_lock); bitmap_free(priv->af_xdp_zc_qps); pm_runtime_disable(dev); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index e137fb9012d4..aea235a69105 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -1028,8 +1028,6 @@ static int tc_taprio_configure(struct stmmac_priv *priv, GFP_KERNEL); if (!priv->est) return -ENOMEM; - - mutex_init(&priv->est_lock); } else { mutex_lock(&priv->est_lock); memset(priv->est, 0, sizeof(*priv->est));