Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp411212rwb; Tue, 6 Dec 2022 23:34:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf5M6RPkcVHmkQDO3Zy+EiZrMQVveaAaXHhb8WsTlmevxLugGNtNAzOcwnpaGTMbz1fOtyVg X-Received: by 2002:a17:90a:5317:b0:213:34f7:fb14 with SMTP id x23-20020a17090a531700b0021334f7fb14mr100891000pjh.25.1670398472832; Tue, 06 Dec 2022 23:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670398472; cv=none; d=google.com; s=arc-20160816; b=ZUDgnkt0guCwKB8Atf9Xbfm4Z1m8FClK9mlKv99I/BJ/n1/RrcAkDtGEe10AqMNkL7 +B+bHMiBEFv5Ukltr3ppVYdyeqCLWJUOXC+k4enVa3usC3vPZqea8LWMuFn0EeyP2fj7 Umrf3Vb0PEok0JpdLaAnF2wKqBWyRvP2k3yzSFlf3IfaqMIVtx1jd6xJxfvMclE8KKa8 d0qD4QQQNFRALkMOt5g2OOEATWDbwrX3xTwYBhPc9MRkXMP2ZoopEB9OR8aljYd7vxuZ qP2O6tBZstVeKI9VVYSSstKHME+Nr6mxlQTMnK/ZtYhfR9IIZVO/kyKBvcYe0g80d+MG 5QnQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s25-20020a632159000000b004785a1141cbsi19806780pgm.485.2022.12.06.23.34.22; Tue, 06 Dec 2022 23:34:32 -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 + 77 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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 --- 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; } -- 2.25.1