Re: [PATCH v7 18/22] wifi: nxpwifi: add core driver implementation
From: Abdun Nihaal
Date: Thu Nov 20 2025 - 10:48:05 EST
On Mon, Nov 17, 2025 at 07:00:42PM +0800, Jeff Chen wrote:
> diff --git a/drivers/net/wireless/nxp/nxpwifi/main.c b/drivers/net/wireless/nxp/nxpwifi/main.c
> +
> + adapter->workqueue =
> + alloc_workqueue("NXPWIFI_WORK_QUEUE",
> + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 0);
> + if (!adapter->workqueue) {
> + ret = -ENOMEM;
> + goto err_kmalloc;
> + }
> +
> + INIT_WORK(&adapter->main_work, nxpwifi_main_work);
> +
> + if (adapter->rx_work_enabled) {
> + adapter->rx_workqueue = alloc_workqueue("NXPWIFI_RX_WORK_QUEUE",
> + WQ_HIGHPRI |
> + WQ_MEM_RECLAIM |
> + WQ_UNBOUND, 0);
> + if (!adapter->rx_workqueue) {
> + ret = -ENOMEM;
> + goto err_kmalloc;
> + }
> +
> + INIT_WORK(&adapter->rx_work, nxpwifi_rx_work);
> + }
In nxpwifi_add_card(), if the allocation of rx_workqueue fails, then the
adapter->workqueue is not freed in the error path. The function which
frees the workqueues nxpwifi_terminate_workqueue() is on err_registerdev
Should one or both goto in the workqueue allocations error path jump to
err_registerdev label instead of err_kmalloc?
> +err_registerdev:
> + set_bit(NXPWIFI_SURPRISE_REMOVED, &adapter->work_flags);
> + nxpwifi_terminate_workqueue(adapter);
> + if (adapter->hw_status == NXPWIFI_HW_STATUS_READY) {
> + pr_debug("info: %s: shutdown nxpwifi\n", __func__);
> + nxpwifi_shutdown_drv(adapter);
> + nxpwifi_free_cmd_buffers(adapter);
> + }
> +err_kmalloc:
> + if (adapter->irq_wakeup >= 0)
> + device_init_wakeup(adapter->dev, false);
> + nxpwifi_free_adapter(adapter);
> +
> +err_init_sw:
> +
> + return ret;
> +}