From patchwork Wed Dec 7 07:20:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqiang Liu X-Patchwork-Id: 30667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp32893wrr; Tue, 6 Dec 2022 23:24:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf4fVUZcjq2AmkGvVcFP/XzDnjuftMai6I6vztaPih+xiIfLmfuSiY7FHiUPvOORN+UB1uZf X-Received: by 2002:a17:902:cf0e:b0:17c:5b01:f227 with SMTP id i14-20020a170902cf0e00b0017c5b01f227mr72392844plg.3.1670397847452; Tue, 06 Dec 2022 23:24:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670397847; cv=none; d=google.com; s=arc-20160816; b=f2dKjGvRBDMnj43IsiTGY7Qeks/AwEW/G54EjgZEEe0q7z9GhU/b2kwMeEreVe/GXF uS2KU2VznnKw8nxEANGq+ahAQtJtbyi4NvRxnidPuUMEW+ZfSq9tCoTE5volbxM4IGmo NrYAL5rHQsc0VEqEMvpDzzytE+RyfFSnQjHlOnUartzFCxo1S1pif4QlnWJosS9zYO7z KWmXAdyCe2rAZl08MSOrsxtHCpgD2G4HWDbrzKTxCfQv5mpWmzLs0s5ZGPHqvThcJ4Ii AkMVPsFYQcvd82keJPsENhlbfm4nMCSDoHW/yYojTeWEAfWqZeqAvmd18ENRsZ+V/gCh Z1ig== 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=E1zKX75GUnSiYwdT2vQk2MwyCLKwrsaIOk8ygwJ7RMk=; b=rSeF6SbUG5Un0T107n+O775O1BGGuvq6Fy/9mLt1Ek3SAw6jFX9GRUuh5QHDTt0FsQ Fhv/VBxBqgPSpbdrwGGgl3QccaQ77lT0I/EnVF4Xqx64QpsyFrCM3Ph8Q+WGheqUdG8Y ZMzdp2Rb5T/eJ/9vwEsC6Ev+VSRcVpJDOs8KtEPu+DQcEJV44kXPPQ5luUD9NQ/t5jai g9Msp9eIY1Q32T5AWb7Q3VhYflcMB60KrwqzZ/sIL0DWAsgMBm6RnMPSDtOBMUk14057 agj2b8J6v2clrZuFji6ePgUaRctCVzfG6R1+pVzEnXyRZGlgMtk/ok5vVvr+nMnA3Elw xJLg== 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 eb19-20020a056a004c9300b0056cb8f6f027si19458014pfb.357.2022.12.06.23.23.54; Tue, 06 Dec 2022 23:24:07 -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 S229818AbiLGHWu (ORCPT + 99 others); Wed, 7 Dec 2022 02:22:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbiLGHWS (ORCPT ); Wed, 7 Dec 2022 02:22:18 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4272D3FBAF; Tue, 6 Dec 2022 23:21:02 -0800 (PST) Received: from dggpeml500005.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NRpW7243LzgYyh; Wed, 7 Dec 2022 15:16:51 +0800 (CST) Received: from huawei.com (10.175.112.125) by dggpeml500005.china.huawei.com (7.185.36.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Dec 2022 15:20:55 +0800 From: Yongqiang Liu To: , CC: , , , , , , , , , Subject: [PATCH net] net: defxx: Fix missing err handling in dfx_init() Date: Wed, 7 Dec 2022 07:20:45 +0000 Message-ID: <20221207072045.604872-1-liuyongqiang13@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500005.china.huawei.com (7.185.36.59) 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?1751539093331731322?= X-GMAIL-MSGID: =?utf-8?q?1751539093331731322?= When eisa_driver_register() or tc_register_driver() failed, the modprobe defxx would fail with some err log as follows: Error: Driver 'defxx' is already registered, aborting... Fix this issue by adding err hanling in dfx_init(). Fixes: e89a2cfb7d7b5 ("[TC] defxx: TURBOchannel support") Signed-off-by: Yongqiang Liu Reviewed-by: Jiri Pirko Acked-by: Maciej W. Rozycki --- drivers/net/fddi/defxx.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c index b584ffe38ad6..1fef8a9b1a0f 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c @@ -3831,10 +3831,24 @@ static int dfx_init(void) int status; status = pci_register_driver(&dfx_pci_driver); - if (!status) - status = eisa_driver_register(&dfx_eisa_driver); - if (!status) - status = tc_register_driver(&dfx_tc_driver); + if (status) + goto err_pci_register; + + status = eisa_driver_register(&dfx_eisa_driver); + if (status) + goto err_eisa_register; + + status = tc_register_driver(&dfx_tc_driver); + if (status) + goto err_tc_register; + + return 0; + +err_tc_register: + eisa_driver_unregister(&dfx_eisa_driver); +err_eisa_register: + pci_unregister_driver(&dfx_pci_driver); +err_pci_register: return status; }