From patchwork Wed Nov 9 03:52:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 17338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp125253wru; Tue, 8 Nov 2022 19:57:57 -0800 (PST) X-Google-Smtp-Source: AMsMyM7NGHxqUHUsf5pB+lMSdcOaAElDAv6jDNpKMS++8+CilQGTYfed88LLnsKRBAlAcgj7cYTC X-Received: by 2002:a17:907:212b:b0:7ae:430e:4e73 with SMTP id qo11-20020a170907212b00b007ae430e4e73mr21324891ejb.707.1667966277771; Tue, 08 Nov 2022 19:57:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667966277; cv=none; d=google.com; s=arc-20160816; b=Hw3vMdnSfS1R8+7unhDrGettt/Da8WgQ8tPPb+EGWLtusP4P2Xi1Z9rNmVsPs1/V6L w48xkvdM2QMq3oExLSVFjADEO04MZDdOvwc54fdxErPi6F/eK/mP1GvTSAzUIXuP5/eN D94kx1arO4PhVX2CzXY766i7PQnM8TmG15j/fLQB7EVGRFhsuNK5hxILXLPOCHNmjGDy oP7Trj9skeE508Ib47lD0R5F/tsI32xBPOq+DSrWhieD08qAOeu6jIe+bovj/fF0n0zz 8eTEftVyR86dqpIXQc7R9NMtDG2akZa3+9NpbqYtkzTTTkEmrTOuV/Rzg2XnpOPV1vNM r21Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=yaRTzfMGqt4JQDOCnC/bdeWXERxrRG6SBVGQ0Y4hE/w=; b=Cj4GcGJRE1d5iRplRcjmjHMq2cuJhIv0mLSSxHRqWCLbWoOZ6/iCA/C4gcIdnodoAn SrkQoXow46iUWAfU/Fui9TH8Lq3dBBlK8p69v0l1UwYVRIUaab7903FzdfAK9sDM1l4z rRI9t6iqyG+HC+gOh0kyu1gIwyqFvu4CIP2z04L+b2NCSGiuKitbJI/axbuenXJOqfYm C4v4WD4emg4CgOsvaZQiGd2fip5fpTESiJ3gKQOjF9cQIb1AN0yOIgmskxjUI31zgkoQ jxgTTVU2m32rbJIc+UcZjp5ganEL/2na2M/JMpkwhrsK5/1SjfYrxbfOYq7wwEbIdK99 EyaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tl2-20020a170907c30200b0073cd848ae8asi11458552ejc.321.2022.11.08.19.57.34; Tue, 08 Nov 2022 19:57:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbiKIDzb (ORCPT + 99 others); Tue, 8 Nov 2022 22:55:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbiKIDz3 (ORCPT ); Tue, 8 Nov 2022 22:55:29 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B38175B4; Tue, 8 Nov 2022 19:55:28 -0800 (PST) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N6WMT4pJKzRp1R; Wed, 9 Nov 2022 11:55:17 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.58) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 9 Nov 2022 11:55:26 +0800 From: Xiu Jianfeng To: , , , , , , , , , , , CC: , Subject: [PATCH] wifi: iwlwifi: Fix memory leak in iwl_mvm_init() Date: Wed, 9 Nov 2022 11:52:13 +0800 Message-ID: <20221109035213.570-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748989407775091396?= X-GMAIL-MSGID: =?utf-8?q?1748989407775091396?= When iwl_opmode_register() fails, it does not unregster rate control, which will cause a memory leak issue, this patch fixes it. Fixes: 9f66a397c877 ("iwlwifi: mvm: rs: add ops for the new rate scaling in the FW") Signed-off-by: Xiu Jianfeng --- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index d2d42cd48af2..8374c2c3d31b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -64,8 +64,10 @@ static int __init iwl_mvm_init(void) } ret = iwl_opmode_register("iwlmvm", &iwl_mvm_ops); - if (ret) + if (ret) { pr_err("Unable to register MVM op_mode: %d\n", ret); + iwl_mvm_rate_control_unregister(); + } return ret; }