From patchwork Tue Nov 8 13:38:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 17044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2713486wru; Tue, 8 Nov 2022 05:43:30 -0800 (PST) X-Google-Smtp-Source: AMsMyM6Q5j+q3AIDHeCe6YcFMA8F3RzsOIV5a9yJ+pCWCjd+UbTOfD6SYbz48F9KWkVC9d8onrHS X-Received: by 2002:a17:90a:db93:b0:214:1671:a106 with SMTP id h19-20020a17090adb9300b002141671a106mr39215708pjv.4.1667915010201; Tue, 08 Nov 2022 05:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667915010; cv=none; d=google.com; s=arc-20160816; b=MTYDpk6paTjEyNPREJqKW2xF3hMtqWXIcNMXejTe6x48uUpET7LwSUsRTpL1P8/eii apF0kRU6WzTZLUKJT0LTJHEiLYrxhVty+Swvk+gXhQEVIQFrYL03CTIvCZcL107DxsLC 6ys4Mcj1P8OcLsgpCp9kBa8fwWvyk1dQ2cYICFBwnUByLP9FZ9F0FDlzAYMORpfv3fyg 78ihGg4t07OQZyVt3KmUj1Lk5uEfkc7F3yyhRcpuKt9qVgG6VVCdlJXhsqYwQGln5JcR Bkxq+rKrQO9cCtjaHq7iy7d95dPoRhbh+npZ8+RFhdFyoLCU3ihFuaRqdsHVtllLWj+2 8NXw== 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=ipiMobor9PzkAX81HhWAXbhtf6VZNWKAUc3bfjWFe3U=; b=sX8iRUY7v7MyikmFjImNBRR4Mo0+hZugmDe2rS1tu0LvnfTT74wkPOZCVjnchXsbfZ q13PJVllL1Ker25U9cc4/7wW40hb01nnHH0v9Zyw8GdUGoZ8F+9NWN5rFxQwxcpe5eHm BJfJptghGVNJqA1GUR9v+qowu6sEldmdi0IM1XuQir+pzcKXhDnKUnz0k71JUYjkFbgv T+IGzw8OA4ml8+AwAm5kDrsgEOVj+c9RWMGXo/DMF/Uv1FFB0CCELHWN6DHBOsw+QlT4 2Dd2HuWByeRnUg/GzNhr+SSbCNGsny39wCGZRTM9xm3QshVW4muALOcm/w9TTeWPLbCz c4ZQ== 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 t14-20020a170902e84e00b0018685257c0csi16300198plg.121.2022.11.08.05.43.15; Tue, 08 Nov 2022 05:43:30 -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 S234460AbiKHNnE (ORCPT + 99 others); Tue, 8 Nov 2022 08:43:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbiKHNnB (ORCPT ); Tue, 8 Nov 2022 08:43:01 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D5663207B; Tue, 8 Nov 2022 05:43:01 -0800 (PST) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N68Rb3L0jzHvg3; Tue, 8 Nov 2022 21:42:35 +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; Tue, 8 Nov 2022 21:42:52 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH] wifi: ath10k: Fix resource leak in ath10k_pci_init() Date: Tue, 8 Nov 2022 21:38:58 +0800 Message-ID: <20221108133858.53308-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: dggems701-chm.china.huawei.com (10.3.19.178) 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?1748935649842075335?= X-GMAIL-MSGID: =?utf-8?q?1748935649842075335?= When ath10k_ahb_init() fails, it does not unregister ath10k_pci_driver, which will cause a resource leak issue, call pci_unregister_driver() in the error path to fix this issue. Fixes: 0b523ced9a3c ("ath10k: add basic skeleton to support ahb") Signed-off-by: Xiu Jianfeng --- drivers/net/wireless/ath/ath10k/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index e56c6a6b1379..22f8f8b20762 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3800,8 +3800,10 @@ static int __init ath10k_pci_init(void) ret); ret = ath10k_ahb_init(); - if (ret) + if (ret) { printk(KERN_ERR "ahb init failed: %d\n", ret); + pci_unregister_driver(&ath10k_pci_driver); + } return ret; }