Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1173220ybl; Tue, 13 Aug 2019 08:28:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyGuw0vgVEy1yEBbBgDwojRjGzqhy3l8C0jXYKzg4F6RQ27lSw9FzEpj4FjavtgRiOZ0oR X-Received: by 2002:a17:90a:d793:: with SMTP id z19mr2724257pju.36.1565710095894; Tue, 13 Aug 2019 08:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565710095; cv=none; d=google.com; s=arc-20160816; b=fGpg6zUMUD/xqq0117eW1RLt2OSeI01TPQ7U3M1ERZQE1tygkAm5VkawTIwrCreCSk ym0Woc6A64ddkQnGjfmpOi4nDEEA7vqsuMkH1j0KSVCLlVw7WtBM7uH8vsq0Cjwjo9D1 i9RgOreesSHDi6DL0w4W4aB9bLkxlXtrIOi4s+ZGIfd4eiurdl12SCh0hpglk/D+Bq5O LTn5DrJf9jzAFvNJQMaE4NYclvIYQsjVmd1Ei1/K2mqU8pg4f7fy+qTTH3m+OV0Vs73G tYpHKiyO8LVmRumhXPSwvmVnq8homf3v8maQZyeVfh+HuvGW7vGS3zA3lGnCfH6vTwZz uE1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=fzZl7B1+1txSvHgybcxsX0rxyo7EfCwFjprnWxSoF8k=; b=fpEYxQjL1bIZN+hkvgi+hwCYHmvbXR164SiPivH1J+GfqWjtsoVj7Tst+iQE9RuCd7 +HQ/gGAgOxjtLZ6ar5mI6lUItESOldufh5Nf8YKm9JrCNOQjVIPdnQF+7xEdv/7v+PWc cehO617//oVpZ1EYhOV6I+VvbJjfpU9/fc35IFQUuM+sKqXa5B/mhZmj8S6QQ7WMwJWT qS1LQV/ZZiMud9ThfPee6bWHYkOnVu3igYyTDG0pPILQvcLy97VSfC1/3LvFw6n1o4Aa u/dj03nX+AmrM/6ELXVMXFIeCwMHa0amjPb/X75F7EHSRgV8OeZm9MVMDCOFjeNGK9Xv S0Sg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si59535406pla.75.2019.08.13.08.27.59; Tue, 13 Aug 2019 08:28:15 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728343AbfHMMnX (ORCPT + 99 others); Tue, 13 Aug 2019 08:43:23 -0400 Received: from inva021.nxp.com ([92.121.34.21]:51664 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728451AbfHMMnQ (ORCPT ); Tue, 13 Aug 2019 08:43:16 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 41975200781; Tue, 13 Aug 2019 14:43:15 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 351C3200791; Tue, 13 Aug 2019 14:43:15 +0200 (CEST) Received: from fsr-ub1464-137.ea.freescale.net (fsr-ub1464-137.ea.freescale.net [10.171.82.114]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id DFD402060E; Tue, 13 Aug 2019 14:43:14 +0200 (CEST) From: Ioana Ciornei To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: joe@perches.com, andrew@lunn.ch, ruxandra.radulescu@nxp.com, Ioana Ciornei Subject: [PATCH v3 09/10] staging: fsl-dpaa2/ethsw: register_netdev only when ready Date: Tue, 13 Aug 2019 15:43:06 +0300 Message-Id: <1565700187-16048-10-git-send-email-ioana.ciornei@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1565700187-16048-1-git-send-email-ioana.ciornei@nxp.com> References: <1565700187-16048-1-git-send-email-ioana.ciornei@nxp.com> Reply-to: ioana.ciornei@nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The register_netdev() call should be made only when ready to process any user request on the interface. Move the call to be the last one issued in the probe sequence. Reported-by: Andrew Lunn Signed-off-by: Ioana Ciornei --- Changes in v2: - added Reported-by tag Changes in v3: - none drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 28da109aef5e..14a9eebf687e 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1588,23 +1588,21 @@ static int ethsw_probe_port(struct ethsw_core *ethsw, u16 port_idx) port_netdev->min_mtu = ETH_MIN_MTU; port_netdev->max_mtu = ETHSW_MAX_FRAME_LENGTH; + err = ethsw_port_init(port_priv, port_idx); + if (err) + goto err_port_probe; + err = register_netdev(port_netdev); if (err < 0) { dev_err(dev, "register_netdev error %d\n", err); - goto err_register_netdev; + goto err_port_probe; } ethsw->ports[port_idx] = port_priv; - err = ethsw_port_init(port_priv, port_idx); - if (err) - goto err_ethsw_port_init; - return 0; -err_ethsw_port_init: - unregister_netdev(port_netdev); -err_register_netdev: +err_port_probe: free_netdev(port_netdev); return err; -- 1.9.1