From patchwork Thu Nov 10 03:12:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 17938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp702334wru; Wed, 9 Nov 2022 19:25:44 -0800 (PST) X-Google-Smtp-Source: AMsMyM4miOF5iuo1cECz4M/MrriPZlhfRmJmUDyAOB6l1RI2oWOT/jrMu61sd/9Uqtlf5D2vZpjp X-Received: by 2002:a50:fd15:0:b0:462:30e4:fcf5 with SMTP id i21-20020a50fd15000000b0046230e4fcf5mr1508950eds.115.1668050743965; Wed, 09 Nov 2022 19:25:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668050743; cv=none; d=google.com; s=arc-20160816; b=0q9K5aih1XxdbKjd0aB5Ulij3J04m0RFNjJUD3jzc1IWu2DRy1Y/z0onZsKB0ke8GO SHXtQH+Gro34FAopR/VmDnyb+adM0hko5CZyQKyPl4PpYLCXXRmQmjVHKs/2AkRTK0VS Sz3VHvosdiUrQdlViIOX5ibEHuxdY+/R1rORO99egK+i/BEa15QRhk8QLZlno3FGLODk kaK6p8gzaPZvQqOTLfAFZDBgqFnv2VTDYITXxuAHeVYXRLIJmOChuXF6e30PJT58tKuv i+4utbipPjiZ9EKGuAZZWbLsgUjDdPqqWVO02uFK1xduTFM7RQpp038XK1onIRpz9NkH Fulw== 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=5Z1z9bvM4moMoQc3G+RKTf2L53Z23El+NSE0z7aVB6o=; b=xr+/ITUiXDp4OQ1mp+2hSwiwz4jehTlpivVGSF8Ttt+/UqXNhOAcNlZg8YVb9hSlzD qUxPD2k+AmnZIJTNwAmG/jj5p5yI30S64eKJqgM/Ih8Umxjxj21qG+wy2NXMgvrZ0car P4dC7OcL04Ak7I6faX87RfmCjAkN5o97gZ6CtCN/kaeS2HIS5W0DP6O4lyiE4+OsrgMS /twBXGJWCvUnLkZ6QBxFfoumQaaFDoAkXOZPaJWn9PRgjB84Ump+BD3Q9FfZ2IyawrEF EXCa34OhwghQGZNaGvB7UGCl3BNM02ulNOCMw/TdbOubWp0CkTPCvx/QFY1tqES8nZuC hmmQ== 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 g16-20020a056402321000b0046277d2cb0csi17302638eda.470.2022.11.09.19.25.20; Wed, 09 Nov 2022 19:25:43 -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 S232142AbiKJDPo (ORCPT + 99 others); Wed, 9 Nov 2022 22:15:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbiKJDPm (ORCPT ); Wed, 9 Nov 2022 22:15:42 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5676B1C911; Wed, 9 Nov 2022 19:15:41 -0800 (PST) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N76Qp2cBJzHvbv; Thu, 10 Nov 2022 11:15:14 +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; Thu, 10 Nov 2022 11:15:39 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH v2] wifi: ath10k: Fix return value in ath10k_pci_init() Date: Thu, 10 Nov 2022 11:12:28 +0800 Message-ID: <20221110031228.247361-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: dggems706-chm.china.huawei.com (10.3.19.183) 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?1749077977124683647?= X-GMAIL-MSGID: =?utf-8?q?1749077977124683647?= This driver is attempting to register to support two different buses. if either of these is successful then ath10k_pci_init() should return 0 so that hardware attached to the successful bus can be probed and supported. only if both of these are unsuccessful should ath10k_pci_init() return an errno. Fixes: 0b523ced9a3c ("ath10k: add basic skeleton to support ahb") Signed-off-by: Xiu Jianfeng --- v2: modify according to Jeff's suggestion, and change the commit message and body as well. --- drivers/net/wireless/ath/ath10k/pci.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index e56c6a6b1379..728d607289c3 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3792,18 +3792,22 @@ static struct pci_driver ath10k_pci_driver = { static int __init ath10k_pci_init(void) { - int ret; + int ret1, ret2; - ret = pci_register_driver(&ath10k_pci_driver); - if (ret) + ret1 = pci_register_driver(&ath10k_pci_driver); + if (ret1) printk(KERN_ERR "failed to register ath10k pci driver: %d\n", - ret); + ret1); - ret = ath10k_ahb_init(); - if (ret) - printk(KERN_ERR "ahb init failed: %d\n", ret); + ret2 = ath10k_ahb_init(); + if (ret2) + printk(KERN_ERR "ahb init failed: %d\n", ret2); - return ret; + if (ret1 && ret2) + return ret1; + + /* registered to at least one bus */ + return 0; } module_init(ath10k_pci_init);