Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2330401pxb; Sat, 25 Sep 2021 04:29:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh2hqU5VKfxy0jt3Zhe964kugBAJ17RnTwMecxCvRFP8+gEVwas6QbAnZ3ZX0hkKQ3LnHe X-Received: by 2002:a50:d8c5:: with SMTP id y5mr10798968edj.370.1632569346624; Sat, 25 Sep 2021 04:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569346; cv=none; d=google.com; s=arc-20160816; b=DhzqzJam+8x7m6iPPYDwO2wh3nnl4UCBlUyusW9nKDda74Mt7T4FQomvUODF8758VY 2H9zk4Iof4/J3nd3cazxQPrt4cQ+7pTcd0nFEOXzAyPRsL5ciIfNwMkgUAHyK51xh1mk /8RMsKvAKXLWMKS5VEBPluh2OJ13PGYudCIB7ycWvZimBTHCjMssw9SBMGzNUbjZ2zks Y3Ea2SzdQXj3GrgiL1h6D9v99t4JLiTSdRZsrCu5PGlP5aUP9KoOD0e18AAjbpta4NaQ pki/g/bcJbaPCJ9soUtVAHEe4mmaBZFx43bAgAN1P8p8lS6Ki4zlLeKExRDEOworOFeq LSPg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+8LpMPwXDtmvaJEexw3Qkk4VXNu64l7r8rHvAKAIQ8c=; b=Fd0cnQqK7xMRV7/7f1J+znUDr9nW/rjCnjL0iJ2ZKoXTi7pZHXWQCRpABHaJ+bUWwg PEzKLKe/7+4KOI3mTSwbz5psXmD42NPsUVk/EM4onDHPxU+/GrcPtNI75OCxhUfySuuV oji5nJeTaemGc5bHm+zDHDYNfJ5K4uG03YpCtcKq3gBD2hXvKYVmt606e/q5uCWuXm3T EXCRbvVBaPwvbwfax1VByaiCPFq9C9i/WElJ3GVYSAcPyteU4fWzW53J3dVeDq45BVz2 KbYgj/HXssU2GlWsD3nDEzU5R0ONZM1segXOd0AMx+HBxkdyjJmuAcGtsmmvn8L41uwN JL8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hBZGKXwn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 17si1079749eja.485.2021.09.25.04.28.43; Sat, 25 Sep 2021 04:29:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hBZGKXwn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244928AbhIYL0Z (ORCPT + 99 others); Sat, 25 Sep 2021 07:26:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:57390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245087AbhIYLZq (ORCPT ); Sat, 25 Sep 2021 07:25:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0ACD06128E; Sat, 25 Sep 2021 11:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569051; bh=hIaU3zuCJ66VCcfkvkXkjfrXrZk0nBwoxqfW+xbNAI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hBZGKXwn8MuXnfyIESlBTW1o1wITt4RwTx900BqVAekSocAOEd7gZDaIl7tnVZv6M q3Q21JYh+9eSN/awnLVNufvGKHgKSaIWRJy5ivfUktMueUS9g5/hLo0Uv9rxmHf4Ne 211pPeYPpZMV6Ds75i05viWIuvhchW2NqqBhX4a07FEQj6wHLw3UpJKiYkdxkk0lFm bSZeh9Ke9vA+QngTRqW5Hu6S/Ti3v116zfBVCHrWYNiVgXRCmPHe0DYiSJ82TIpPaL C4vY9albBFHKQVnNf6fAbGot8HbEqBfjq0pJUTWDackF/nuQF7xemq0NLd1sc8oYoz jySHQjT6V/w9w== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Alexandre Belloni , Andrew Lunn , Ariel Elior , Bin Luo , Claudiu Manoil , Coiby Xu , Derek Chickles , drivers@pensando.io, Felix Manlunas , Florian Fainelli , Geetha sowjanya , Greg Kroah-Hartman , GR-everest-linux-l2@marvell.com, GR-Linux-NIC-Dev@marvell.com, hariprasad , Ido Schimmel , Intel Corporation , intel-wired-lan@lists.osuosl.org, Ioana Ciornei , Jerin Jacob , Jesse Brandeburg , Jiri Pirko , Jonathan Lemon , Linu Cherian , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, Loic Poulain , Manish Chopra , M Chetan Kumar , Michael Chan , Michael Guralnik , netdev@vger.kernel.org, oss-drivers@corigine.com, Richard Cochran , Saeed Mahameed , Satanand Burla , Sergey Ryazanov , Shannon Nelson , Simon Horman , Subbaraya Sundeep , Sunil Goutham , Taras Chornyi , Tariq Toukan , Tony Nguyen , UNGLinuxDriver@microchip.com, Vadym Kochan , Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next v1 20/21] staging: qlge: Move devlink registration to be last devlink command Date: Sat, 25 Sep 2021 14:23:00 +0300 Message-Id: <87eb1893ae465eb0ec1ed726c9ca078edc8298ac.1632565508.git.leonro@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky This change prevents from users to access device before devlink is fully configured. Signed-off-by: Leon Romanovsky --- drivers/staging/qlge/qlge_main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 33539f6c254d..1dc849378a0f 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -4614,10 +4614,9 @@ static int qlge_probe(struct pci_dev *pdev, goto netdev_free; } - devlink_register(devlink); err = qlge_health_create_reporters(qdev); if (err) - goto devlink_unregister; + goto netdev_free; /* Start up the timer to trigger EEH if * the bus goes dead @@ -4628,10 +4627,9 @@ static int qlge_probe(struct pci_dev *pdev, qlge_display_dev_info(ndev); atomic_set(&qdev->lb_count, 0); cards_found++; + devlink_register(devlink); return 0; -devlink_unregister: - devlink_unregister(devlink); netdev_free: free_netdev(ndev); devlink_free: @@ -4656,13 +4654,13 @@ static void qlge_remove(struct pci_dev *pdev) struct net_device *ndev = qdev->ndev; struct devlink *devlink = priv_to_devlink(qdev); + devlink_unregister(devlink); del_timer_sync(&qdev->timer); qlge_cancel_all_work_sync(qdev); unregister_netdev(ndev); qlge_release_all(pdev); pci_disable_device(pdev); devlink_health_reporter_destroy(qdev->reporter); - devlink_unregister(devlink); devlink_free(devlink); free_netdev(ndev); } -- 2.31.1