Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1693606ybl; Wed, 28 Aug 2019 19:48:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjtJk3pv10yqhD4JDIccDsboGRFdqAYag5Q2vtWCInuesoPp+GOatGpzNc0P7I2K+WEVvH X-Received: by 2002:a63:1c22:: with SMTP id c34mr6218708pgc.56.1567046894544; Wed, 28 Aug 2019 19:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567046894; cv=none; d=google.com; s=arc-20160816; b=jhNz7kNWwb3mZYo1FQpDLCWqQPxriF53/BniCG8TC/hZ4/7qrbFtB0zjQSM3UMZwFi IPAStEdLFEhTHbyGzwOwTUf+f4meeLI0ovyoaKv+rsz/Os/PMgGhDVCmdPrtZjzkokZC MiUvL3lPPtsXrPDoW08Dbr91coxWZs+LneGVCnzAus2i8ymFsfiyZujCCMtxEWwc624x jRBPkJAOA7e6ZD/0tjUer0CTgX5iL77OfwzUwjygMcBd1rssByFglqQP1f6hrkV8hIqw D1maFYVqO+DZmvcSs+R4/gQYv8BVmFMhfeKSRnEddSqWTnbUat4t1ZWpsgHBdLs6Q6oj Jt2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=+sZwWsfa9RIRFqfJkSDGzOjR7yBvRQFmTGQV0mklyvk=; b=ku94io/SWGaJvCvs0kC9nmEJpN1w8txq5XM6A6nscifu12oAxeg5UAICiBL4bM2I2i U3m5PrComUbU/Hukm5+b4uFmRZ2RjeM+6eHpbQvCvKQl0gpv2U5wWOzKrU/DRAhaikqB zONeFrc7I55VsJQ8/S8+0aLpx4WHACeHqr4ZOiRhEv8niRgRwf95jf8J/OpZeU84lESD KmTtFnctKl3N1YvnNu6zBHaem/Yqa8MwI5+0h3AmUnYwyQlkhghuRLYy1wKvVGeH2CCn KbPkN2kdjXbXGxJKKApE0rNp6Zznccn2aMuuSkO2/bkClBF1q49QbONmpnQaNpz1e1y+ uZ9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21si754354pgb.209.2019.08.28.19.47.59; Wed, 28 Aug 2019 19:48:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727204AbfH2Cqi (ORCPT + 99 others); Wed, 28 Aug 2019 22:46:38 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:47134 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725844AbfH2Cqi (ORCPT ); Wed, 28 Aug 2019 22:46:38 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A4CA27D1209F358E03DB; Thu, 29 Aug 2019 10:46:36 +0800 (CST) Received: from localhost (10.133.213.239) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 29 Aug 2019 10:46:27 +0800 From: YueHaibing To: , CC: , , YueHaibing Subject: [PATCH] amd-xgbe: Fix error path in xgbe_mod_init() Date: Thu, 29 Aug 2019 10:46:00 +0800 Message-ID: <20190829024600.16052-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.133.213.239] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In xgbe_mod_init(), we should do cleanup if some error occurs Reported-by: Hulk Robot Fixes: efbaa828330a ("amd-xgbe: Add support to handle device renaming") Fixes: 47f164deab22 ("amd-xgbe: Add PCI device support") Signed-off-by: YueHaibing --- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index b41f236..7ce9c69 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c @@ -469,13 +469,19 @@ static int __init xgbe_mod_init(void) ret = xgbe_platform_init(); if (ret) - return ret; + goto err_platform_init; ret = xgbe_pci_init(); if (ret) - return ret; + goto err_pci_init; return 0; + +err_pci_init: + xgbe_platform_exit(); +err_platform_init: + unregister_netdevice_notifier(&xgbe_netdev_notifier); + return ret; } static void __exit xgbe_mod_exit(void) -- 1.8.3.1