Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2329609pxb; Sat, 25 Sep 2021 04:27:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxLrbWHaofR/ZjFLNabjxCNnXyjYxAExheP28ehBHpEVWZ2QlRzvJ63MVwL7zSu5RqL5Rs X-Received: by 2002:a50:fb8f:: with SMTP id e15mr10594441edq.162.1632569263508; Sat, 25 Sep 2021 04:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569263; cv=none; d=google.com; s=arc-20160816; b=frOtYGzMCAsa4q7+7h4XRgIhBWkRB5EXo7LtGXiTnqmknnGF1v44PKX2ibDpLWi4ea cZ/CMBVRo9eOGBA+YH7zYfhtbZ6eCK00W91wsXYCqy/Mk47fCaCwrCGNnIl63cu4qeZR 8g7bMaZ8OTQCEfxmXtQzi3Zi0rZDSpd3AEPAtTWzO0iGocpaROT759p1kNDmnHfN9Qbc nA0DpafzDGdrvAH30P8Qle99atUgY4iwBbLHLNDNM5aoKbdOHUs6jLjwAR/bQfkKsnBn nrQndZCPEipx3J8j/xvMKv44X4iSBxKhfAmkRrzVzliU7Ggx/RRx/3r8H+1lp2ma/0LB HhHQ== 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=lLDOxDK7sIgNGhD0BiAnwxmz8haNcvIz/+SQWWOjW2I=; b=BXNZpZEgU79dK4C/YLSISOLM9R1nUyq4EFqATvhShDJ5Dl4F9pAkAil24hGmWmhEKw cHVSVvpmFMmxgtifXuIEmlDr2taSmRl3CfPVQ7bhKp2R6ozqgbhuPKQVHj8sykj3gtFQ Ja1sfYotoD6cLsByVD4HjFgIfpB/w0b5oa3sbV9hexdEyQ+z1+sdgGZAONuj9u3Zass5 ftZRE7MpkPg3iKQfRJS/QdtkgdR2JsOSM5uQwgXvewcfvaQPZC72NzwLpmFWDZ9ii8xO tkWgZYJXm0AMWz2ZM6mPd4DTIIXygwWYFw2D65VlZWnmcT4vdlkyaVuEBTEWl9vBsev8 xI1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eXJnTqgM; 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 14si12123804ejc.232.2021.09.25.04.27.20; Sat, 25 Sep 2021 04:27:43 -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=eXJnTqgM; 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 S1344002AbhIYL03 (ORCPT + 99 others); Sat, 25 Sep 2021 07:26:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:57282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245756AbhIYLZn (ORCPT ); Sat, 25 Sep 2021 07:25:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CC77061288; Sat, 25 Sep 2021 11:24:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569048; bh=UGe1xR5nQjl5sitWRrZO39MCG615CkI/XgeO5EfkyHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eXJnTqgMbORVHaUsGV03ryKJr6A1PfdhYoeVsyCNEges2Dn9WZ7FE4+7QH3xqJvR9 Mz5qz1HhsuOgoYQOxRRc2geSU+85mrlqpccGRTMS5HNtlTD9qpZiA6BDhj7DVZhKv7 sj2HzVf0JYXhCn2l9u3cBQBv5vEik7dYiF8tPoahtV6EPb5DdE99UK8bicH0CXAY1W HNyqws6BMBbppxtt3484q7TdwfEfbBOeq/bgChcm6v6hSMl1crla5Ovo4z8W/DKqtc ElB0gliFBoCj4F940uxkATHVFsfX4EYpq0KC0xZ9LpCNrkxbV9d5shVyGsAIldIE1K SK3ShGOLcii1A== 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 19/21] ptp: ocp: Move devlink registration to be last devlink command Date: Sat, 25 Sep 2021 14:22:59 +0300 Message-Id: <1541e7cd8262ce9db7544669438d0f4360068dd2.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/ptp/ptp_ocp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 4c25467198e3..34f943c8c9fd 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -2455,7 +2455,6 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) return -ENOMEM; } - devlink_register(devlink); err = pci_enable_device(pdev); if (err) { dev_err(&pdev->dev, "pci_enable_device\n"); @@ -2497,7 +2496,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out; ptp_ocp_info(bp); - + devlink_register(devlink); return 0; out: @@ -2506,7 +2505,6 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_disable: pci_disable_device(pdev); out_unregister: - devlink_unregister(devlink); devlink_free(devlink); return err; } @@ -2517,11 +2515,11 @@ ptp_ocp_remove(struct pci_dev *pdev) struct ptp_ocp *bp = pci_get_drvdata(pdev); struct devlink *devlink = priv_to_devlink(bp); + devlink_unregister(devlink); ptp_ocp_detach(bp); pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); - devlink_unregister(devlink); devlink_free(devlink); } -- 2.31.1