[bug report] wifi: mwifiex: Allocate dev name earlier for interface workqueue name

From: Dan Carpenter

Date: Mon Feb 09 2026 - 04:43:39 EST


[ Smatch checking is paused while we raise funding. #SadFace
https://lore.kernel.org/all/aTaiGSbWZ9DJaGo7@stanley.mountain/ -dan ]

Hello Chen-Yu Tsai,

Commit 7bab5bdb81e3 ("wifi: mwifiex: Allocate dev name earlier for
interface workqueue name") from Jan 7, 2026 (linux-next), leads to
the following Smatch static checker warning:

drivers/net/wireless/marvell/mwifiex/cfg80211.c:3214 mwifiex_add_virtual_intf()
warn: passing positive error code '(-23)-(-22),(-12),1-64' to 'ERR_PTR'

drivers/net/wireless/marvell/mwifiex/cfg80211.c
3147
3148 SET_NETDEV_DEV(dev, adapter->dev);
3149
3150 ret = dev_alloc_name(dev, name);
3151 if (ret)
3152 goto err_alloc_name;

The dev_alloc_name() function can return 1-64 if the name has a "%d" in
it. None of the other nine callers use the positive returns. The only
thing it does is cause a crash here. We should probably fix
dev_alloc_name() as well as changing this to if (ret < 0) {.

3153
3154 priv->dfs_cac_workqueue = alloc_workqueue("MWIFIEX_DFS_CAC-%s",
3155 WQ_HIGHPRI |
3156 WQ_MEM_RECLAIM |
3157 WQ_UNBOUND, 0, dev->name);
3158 if (!priv->dfs_cac_workqueue) {
3159 mwifiex_dbg(adapter, ERROR, "cannot alloc DFS CAC queue\n");
3160 ret = -ENOMEM;
3161 goto err_alloc_cac;
3162 }
3163

regards,
dan carpenter