Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2329949pxb; Sat, 25 Sep 2021 04:28:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze/WSEay6Z1MTJ4clzilebqDkCc6oWdfz2FKzyL0AYcLoAaeU5FQxeeVpjRhF7A02ZlIYX X-Received: by 2002:a50:d0c8:: with SMTP id g8mr10989923edf.177.1632569298668; Sat, 25 Sep 2021 04:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569298; cv=none; d=google.com; s=arc-20160816; b=jB9dQjtm+WzwYJ4SuPI7yf5mEbDK3sKIkyUr8IRRiIbCERPouqrRaEKrYiuB6nNPMJ PB6AXjDztkMlsmzScDge4BAPM332vf06WYcR0HQKXxZdz2CfiSLBqW9ECEPKFzD2mJPO 42sy1QckBaxmfiV/ql2LruQfCCLr8REvEso2WwwJOg9ePtVkJ4xeyPEwQ+gWSwZuS+Tt envWTiy0latShMf5RdJRcXZK2j4gB7o4CXiWvmpk7jtJ7kuFwSA37tfwOJkJgLpsNDQf 23NYATjfq5dOKMmXOBqIXPKuGOrWq4Nt3JL1vmUggzvq/ThCwonmjBMRGojluhCkLr+U hCWw== 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=WXdPLPrEq+aQMA9hmQF99bhXv4H247z8uOF8ISbrw/8=; b=Q5fPur94IWa9sbUBXlBPJOf8qf9QZFEGgCZN7i7hXhufFhN6Dd44BATxesnJKFRCX0 Brv4wMpdO8H3IPkubLCyu4wYvLgJcYMmuZF8v3UpCFDUO4ql/Rex8fUS/uGDwufZM0LX NJEsSEOduZl9RK3mSfAhAN6I7kFbwZDW6HBXHw8YXZePo+XLD/GN6uJ1Dx5lLV8fHbfm vRoH2wyMypwn62Nz2CSuTWXGrPQubi1A/yqNvdOuWIWHiNCkfpDLG0Awx2ZL4WiFqafm UMr/sgML64ph7p3iAmRtkrM4IAMNZ1P4XdttcON8G+he4s1F19julZfx9V6BzvrYeJw+ 1CvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ge34eptx; 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 z70si11201062ede.388.2021.09.25.04.27.53; Sat, 25 Sep 2021 04:28:18 -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=Ge34eptx; 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 S1343556AbhIYL0U (ORCPT + 99 others); Sat, 25 Sep 2021 07:26:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343583AbhIYLZt (ORCPT ); Sat, 25 Sep 2021 07:25:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C0A561350; Sat, 25 Sep 2021 11:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569055; bh=7fuwMn0UcxFbiik3Z+N/XOLwJAq59/miUfWhpOwdqE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ge34eptxt6ik9tM4bBGWV+EhWY2pUsDmBrBnZIJGDR8WqRukI42+ESfMMMV9+gmyk NzOJ5DLBu2o6NL6oi1jrLFHILSXlbaTkjCziDiYsxegSE/Jrp/gGgvJVR7RaEimH2k u2KZhp8p3Q+odnSJGYZYpzbjUOdLrNqJ2GAMUiwsAT61gUQdMMmLpIZkJsjPKLDgja 951E4DCRpAC2brIp9LRFyfkQegtVBAkmpGV+8JNtEYeEpLtKlgfwpF/3fdAikKH6yb 0nLBFwTJ2r2zmbCo8w91OLQqyLpu05TcH/BXTltlVcbcWo+yMP4awblDvVJZGPBPj9 feyG+jP8SLazQ== 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 18/21] net: wwan: iosm: Move devlink_register to be last devlink command Date: Sat, 25 Sep 2021 14:22:58 +0300 Message-Id: <6a63d8f6484a46c9120155082a396b44ce86bd1c.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. Indirectly this change fixes the commit mentioned below where devlink_unregister() was prematurely removed. Fixes: db4278c55fa5 ("devlink: Make devlink_register to be void") Signed-off-by: Leon Romanovsky --- drivers/net/wwan/iosm/iosm_ipc_devlink.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/wwan/iosm/iosm_ipc_devlink.c b/drivers/net/wwan/iosm/iosm_ipc_devlink.c index 42dbe7fe663c..6fe56f73011b 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_devlink.c +++ b/drivers/net/wwan/iosm/iosm_ipc_devlink.c @@ -305,7 +305,6 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) ipc_devlink->devlink_ctx = devlink_ctx; ipc_devlink->pcie = ipc_imem->pcie; ipc_devlink->dev = ipc_imem->dev; - devlink_register(devlink_ctx); rc = devlink_params_register(devlink_ctx, iosm_devlink_params, ARRAY_SIZE(iosm_devlink_params)); @@ -315,7 +314,6 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) goto param_reg_fail; } - devlink_params_publish(devlink_ctx); ipc_devlink->cd_file_info = list; rc = ipc_devlink_create_region(ipc_devlink); @@ -334,6 +332,7 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) init_completion(&ipc_devlink->devlink_sio.read_sem); skb_queue_head_init(&ipc_devlink->devlink_sio.rx_list); + devlink_register(devlink_ctx); dev_dbg(ipc_devlink->dev, "iosm devlink register success"); return ipc_devlink; @@ -341,7 +340,6 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) chnl_get_fail: ipc_devlink_destroy_region(ipc_devlink); region_create_fail: - devlink_params_unpublish(devlink_ctx); devlink_params_unregister(devlink_ctx, iosm_devlink_params, ARRAY_SIZE(iosm_devlink_params)); param_reg_fail: @@ -358,8 +356,8 @@ void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink) { struct devlink *devlink_ctx = ipc_devlink->devlink_ctx; + devlink_unregister(devlink_ctx); ipc_devlink_destroy_region(ipc_devlink); - devlink_params_unpublish(devlink_ctx); devlink_params_unregister(devlink_ctx, iosm_devlink_params, ARRAY_SIZE(iosm_devlink_params)); if (ipc_devlink->devlink_sio.devlink_read_pend) { @@ -370,6 +368,5 @@ void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink) skb_queue_purge(&ipc_devlink->devlink_sio.rx_list); ipc_imem_sys_devlink_close(ipc_devlink); - devlink_unregister(devlink_ctx); devlink_free(devlink_ctx); } -- 2.31.1