[PATCH] wifi: mwifiex: Fix dev_alloc_name() return value check

Chen-Yu Tsai posted 1 patch 1 month, 3 weeks ago
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] wifi: mwifiex: Fix dev_alloc_name() return value check
Posted by Chen-Yu Tsai 1 month, 3 weeks ago
dev_alloc_name() returns the allocated ID on success, which could be
over 0.

Fix the return value check to check for negative error codes.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aYmsQfujoAe5qO02@stanley.mountain/
Fixes: 7bab5bdb81e3 ("wifi: mwifiex: Allocate dev name earlier for interface workqueue name")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index a66d18e380fc..bc0a946e8e6e 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3148,7 +3148,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
 	SET_NETDEV_DEV(dev, adapter->dev);
 
 	ret = dev_alloc_name(dev, name);
-	if (ret)
+	if (ret < 0)
 		goto err_alloc_name;
 
 	priv->dfs_cac_workqueue = alloc_workqueue("MWIFIEX_DFS_CAC-%s",
-- 
2.53.0.rc2.204.g2597b5adb4-goog
Re: [PATCH] wifi: mwifiex: Fix dev_alloc_name() return value check
Posted by Francesco Dolcini 1 month, 3 weeks ago
On Tue, Feb 10, 2026 at 06:03:34PM +0800, Chen-Yu Tsai wrote:
> dev_alloc_name() returns the allocated ID on success, which could be
> over 0.
> 
> Fix the return value check to check for negative error codes.
> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/aYmsQfujoAe5qO02@stanley.mountain/
> Fixes: 7bab5bdb81e3 ("wifi: mwifiex: Allocate dev name earlier for interface workqueue name")
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>