Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13308990rwl; Wed, 4 Jan 2023 06:30:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1ibKJe9P3HBsyOXkITWgzsxMT5wmHiNyGRgKUm6l+VKE4um6IR5g3YfYZKksI05rX/g6O X-Received: by 2002:a17:906:b00d:b0:7c1:8ba6:6eb3 with SMTP id v13-20020a170906b00d00b007c18ba66eb3mr43317458ejy.35.1672842621357; Wed, 04 Jan 2023 06:30:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672842621; cv=none; d=google.com; s=arc-20160816; b=ALQu9wqWhjtR0CkZ6t16cUkTZZ3S7ciJmL85fOphBKL2hdbGUmhhAmTVQ/s+0W8BT4 lNoF6t4GbqXuFobXy2KFQWRh4qQfAKCdHrscKqMmLnvxFMo4Jb/dYh3/VfObl5NO8xlP 548UA29oDxNBuagghNyULTfvtW8mXk9cfC917+bH9iUBj8zX7dH3p4V4CG2R9qL3eqHL W+WFdoCMRhKpr68iSnDuNJ/dW62ZzUrEP/GOXzNFiH8Lw4+O5/XwQb0Y1kwzrm2lte5D dokZWtjXVes1XV+uMmKfRL9mBjBglO5vnB01ZdkneSGkyi6pzeftf048YncS9GpRPzLX 4Dvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=eXtb6Qka6HmOzvI4jfiI5F9f0mSLkXvuxHcyHlC+xFo=; b=iSBdhK/8dZs8jjJLH/Chb6fnNb7f5s+z5G8qyLRJoVi/bRZVRFn0jzkEaJ6fdgqTJI 5lKZR/TNXtkuMJYELsACCkSxR57We6I6dv7KqF84EI9FV3hp57QG0rrszCHoPtpcdd2u KU2NUI6A9DIsWiEgaUmpYjg3+34VGOWvunQm221XxBMimyqFVehSyTkJgPAIbnqy41XQ HaZu6ulUU7Lpq9TyTD/pckZ0mKEpo5TQbaL06Wbp9t0s0g0RZffo0KZmHtccWbAQEd6w LBhmnZmyZ3gW7zOvmSPGuEkMGJjuirWhgLR37SD+71Xwg/ws3WI5NLLHPY1vQODuN+q1 IKDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xj4-20020a170906db0400b007c0b777d1c0si32790966ejb.737.2023.01.04.06.30.02; Wed, 04 Jan 2023 06:30:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234429AbjADO3U (ORCPT + 67 others); Wed, 4 Jan 2023 09:29:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbjADO3P (ORCPT ); Wed, 4 Jan 2023 09:29:15 -0500 X-Greylist: delayed 306 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 04 Jan 2023 06:29:12 PST Received: from cstnet.cn (smtp80.cstnet.cn [159.226.251.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 582281AD99; Wed, 4 Jan 2023 06:29:11 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-01 (Coremail) with SMTP id qwCowACHsO4ujbVjEXbrCg--.46636S2; Wed, 04 Jan 2023 22:29:03 +0800 (CST) From: Jiasheng Jiang To: leon@kernel.org Cc: pkshih@realtek.com, kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH v2] wifi: rtw89: Add missing check for alloc_workqueue Date: Wed, 4 Jan 2023 22:29:01 +0800 Message-Id: <20230104142901.1611-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: qwCowACHsO4ujbVjEXbrCg--.46636S2 X-Coremail-Antispam: 1UD129KBjvJXoW7urWkZrW5Jw1rJw4DGr4kZwb_yoW8Xr1kp3 yrAa45Ja15Gr4DZa1qq3y3uF45W3WrtF4jk3sa9w1ruw1rAwn5W3WYqFy0vrnY9rWqvF15 ArZ5X343JFn5WrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvC14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1lc2xSY4AK67AK6ry5MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r 1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CE b7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0x vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAI cVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2Kf nxnUUI43ZEXa7VUbhL05UUUUU== X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add check for the return value of alloc_workqueue since it may return NULL pointer. Moreover, add destroy_workqueue when rtw89_load_firmware fails. Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver") Signed-off-by: Jiasheng Jiang --- CHangelog: v1 -> v2: 1. Add destroy_workqueue when rtw89_load_firmware fails. --- drivers/net/wireless/realtek/rtw89/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index 931aff8b5dc9..e99eccf11c76 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -3124,6 +3124,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev) INIT_DELAYED_WORK(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work); INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work); rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0); + if (!rtwdev->txq_wq) + return -ENOMEM; spin_lock_init(&rtwdev->ba_lock); spin_lock_init(&rtwdev->rpwm_lock); mutex_init(&rtwdev->mutex); @@ -3149,6 +3151,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev) ret = rtw89_load_firmware(rtwdev); if (ret) { rtw89_warn(rtwdev, "no firmware loaded\n"); + destroy_workqueue(rtwdev->txq_wq); return ret; } rtw89_ser_init(rtwdev); -- 2.25.1