Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp143343pxy; Sat, 14 Aug 2021 03:01:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIfJj/c+aV3l9jv7/6TVs7+LbZ1Bf/sbby4/CZk5N2PqtwEmx7Ket3EjnVZriq+HXOFtP5 X-Received: by 2002:aa7:cd9a:: with SMTP id x26mr8267767edv.26.1628935282102; Sat, 14 Aug 2021 03:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628935282; cv=none; d=google.com; s=arc-20160816; b=vbw4fKWnI7pYmM2LTQAzlSCtkj+uqGxJFE7JHoqFr2iigi5OIsVwbAzxb5KDLtv4Jn uNQ4icPEbj72Xdr4R0GOODS5epR6uLNH8nLqLEFmB34FhDI4kMr9MaeX8dBxQ5a7tXCo HJYuce+WgwKY6H+1aZICzZKGkAnQRm80oP20GS2wVmFD/+GiYrv0HTLSSSRGpyny88n4 pY0Ccbcbg1OuEB1v+BrHcu/FpYecRaOeza00b5PAN6nSOBA8fFwoWTK1L0Nezz7wcIUy HRUoRQZ6pPUiWvwTCmFcW6PmzXPaiDXf5Qr5mne9ueHLL3ua1NtAhANj9qere/QTygMQ PBKg== 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=C/r4jn452PrTc5zzo0Q9EliCqbEetED5zO+A+lRs4NI=; b=ua4hAZElT6XNh4T+IjRPXJ4F33lLqN6sprx7RnF52ohUi8agQXUbnb+6Ai+8zXa/jR bKiEphr0eDiA26A21NZTJNMUIDKQqSZSbTTThhBrJr0lCr+3A0fJ2vFlXe+bKEGGIhiL 4dJMbpFg86h4GPSm9QrqWX91FRLl9hY9SwFXfx59gAN2ZrrfpmVn+QteFuIgTxw8LacQ iZrbY0/9D+Ed3kaRs6MHwcudco0dxo/iV2E6mRfNYvJbM5i8NgheblC2jvpP4aPjMF/P CSQKXoJI6db6CUQ3xfNdbFWvHZriaIriTcbHZfuu0zpXcLPBMTAGPtsYXTEhs+I5a3jH pxwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V9TD8i89; 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 b24si4382794edt.416.2021.08.14.03.00.59; Sat, 14 Aug 2021 03:01:22 -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=V9TD8i89; 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 S238196AbhHNJ7I (ORCPT + 99 others); Sat, 14 Aug 2021 05:59:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:37992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238142AbhHNJ62 (ORCPT ); Sat, 14 Aug 2021 05:58:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 82F5F60E93; Sat, 14 Aug 2021 09:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628935079; bh=M7YYC86V3snE++Hi6R8B+ecf16khmRjxEgwHZa+z11c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V9TD8i89tEyt7fAdnOxqyLQEl4CdbSNmDwgUiJqGumySPI/4rvQi25wgI5OPRJ6c/ tA3ukyLLE7qmoW1oVVlfbC5bUxidpZWk+Ebqem134SKYpxG1juNfQfuaB4pRK//cQV NRVO3156KNQVkFAwkdvF1NKJ/iWxSSeIf7CUilExE1ZH2CEmrdywZ7HrNCm82xAFCe FUe7bdqnwZ+cUY7gtkC2TeaXaw1y0ly8Y+Dt5j+Dy4DRDEJ8vgBNayrxJVqimyKVnY rCqNhl1ewWgmPKu3wkqctqXRwT3GUZAUaHEuLT8EDv34hDyom0mT2gWNy6D/kCwg1O YVI8Rx3RyuB2A== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Guangbin Huang , Jacob Keller , Jiri Pirko , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Salil Mehta , Shannon Nelson , Yisen Zhuang , Yufeng Mo Subject: [PATCH net-next 6/6] net: hns3: remove always exist devlink pointer check Date: Sat, 14 Aug 2021 12:57:31 +0300 Message-Id: <0dfcfa8b12f29955e0aa48d8532bc829b0903b3c.1628933864.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 The devlink pointer always exists after hclge_devlink_init() succeed. Remove that check together with NULL setting after release and ensure that devlink_register is last command prior to call to devlink_reload_enable(). Fixes: b741269b2759 ("net: hns3: add support for registering devlink for PF") Signed-off-by: Leon Romanovsky --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_devlink.c | 8 +------- .../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_devlink.c | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_devlink.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_devlink.c index 448f29aa4e6b..e4aad695abcc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_devlink.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_devlink.c @@ -118,6 +118,7 @@ int hclge_devlink_init(struct hclge_dev *hdev) priv = devlink_priv(devlink); priv->hdev = hdev; + hdev->devlink = devlink; ret = devlink_register(devlink); if (ret) { @@ -126,8 +127,6 @@ int hclge_devlink_init(struct hclge_dev *hdev) goto out_reg_fail; } - hdev->devlink = devlink; - devlink_reload_enable(devlink); return 0; @@ -141,14 +140,9 @@ void hclge_devlink_uninit(struct hclge_dev *hdev) { struct devlink *devlink = hdev->devlink; - if (!devlink) - return; - devlink_reload_disable(devlink); devlink_unregister(devlink); devlink_free(devlink); - - hdev->devlink = NULL; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_devlink.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_devlink.c index 1e6061fb8ed4..f478770299c6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_devlink.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_devlink.c @@ -120,6 +120,7 @@ int hclgevf_devlink_init(struct hclgevf_dev *hdev) priv = devlink_priv(devlink); priv->hdev = hdev; + hdev->devlink = devlink; ret = devlink_register(devlink); if (ret) { @@ -128,8 +129,6 @@ int hclgevf_devlink_init(struct hclgevf_dev *hdev) goto out_reg_fail; } - hdev->devlink = devlink; - devlink_reload_enable(devlink); return 0; @@ -143,14 +142,9 @@ void hclgevf_devlink_uninit(struct hclgevf_dev *hdev) { struct devlink *devlink = hdev->devlink; - if (!devlink) - return; - devlink_reload_disable(devlink); devlink_unregister(devlink); devlink_free(devlink); - - hdev->devlink = NULL; } -- 2.31.1