Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1970039lqo; Mon, 13 May 2024 04:20:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWFPQFMXM87S+BG7mX62i7EenfDujWTXxhqgl0MJQ/tWrezvPGdrXpbaZShmJqdMIwAHmIiklZk3FC5JyfN6xCEXrcpAEh+HGZfnXqtyQ== X-Google-Smtp-Source: AGHT+IGJIX9mU7BFmfZpl/tzbGjmkWtUWH6ZMsEkCYiqL7faHHXQALqUBMlOjRMu3xljC75u+5l7 X-Received: by 2002:a0c:cd8c:0:b0:6a0:f2e0:5070 with SMTP id 6a1803df08f44-6a15cc7d6f8mr195757346d6.21.1715599214416; Mon, 13 May 2024 04:20:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715599214; cv=pass; d=google.com; s=arc-20160816; b=jACERfYUp421/Hn5Vt+qUlGy5f0dyBxmCDQ3BU3p77jTPMZAokaW8EiXZJ0qcCQpvj O43vetiTcZz9q4DvOyiIZa9e8fiew3T+R4GOfYkwZoE31HFplZ/7eyQYcujO0yz2fpfc 6outx++Yc4DVzC0zF8Cz1tLlRotfexoA0Vj5yUHgmdW01Vd4FZTXU8WufLhoU9l05JGB qi58wake9uD98dk8IzRHG5rVITFwnkPQAwbA5DMFix4P9eUvpJMTX7OGhlcu03sRu9GM nPw2M+yJWc3vqRJrY4FoP1g+EDCrs+nUS5RHfxj6UBHBSyudmmRe7ZAyQlV8T2ns2prJ jU4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=gKVOMxd20VDSKzHJcmThHdOq/cAuIl6aUIXNfYUiTgQ=; fh=1wJ+aknmF75wvR1nvt23xCo40rgGHUjOoIcAlEPhvD0=; b=AhyofzudExlV6J6fvUSgOrAVhNJOtJ/+jKGwG1a7tRNZ+/0BvqjdRI3mVVCzPK+/Tc /GOSfY4eO8vQUIw95HAmw6M1RyTyi79NU6nQm955fMd/OwtiPORBEIpRyZe7JIASPKY5 XQ4phKQNo+5ic6z6eiep+L/yd+D14qUq52fwyHB2lL/PvV03aMIproM5HfytxWPZqKA/ 19s666Xel79tFe1OL6aEUXLvlA6QXd9Vkpm9OFoDR+YbJZ8O/u14QelE8XvGb1d4VuBq 4q2VxlnogGNz2qc5jBsRm73kFk55e3sWiGR+s+K6aAx91ONN6mE8yEs5wHy05Ri51HO3 5/Ng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LLskMZLo; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-177495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177495-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f1d6d48si96505546d6.48.2024.05.13.04.20.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 04:20:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LLskMZLo; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-177495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177495-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 24A8D1C22340 for ; Mon, 13 May 2024 11:20:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79B9014D290; Mon, 13 May 2024 11:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="LLskMZLo" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7534714BFA2; Mon, 13 May 2024 11:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715599168; cv=none; b=jQJ2J8UoTu1V0Vjb3TW8gpu8SgE9MqX8TDpy/b6a0m1uFBL1Q7YHzXtPzudJcPQd1+YBQpugUjLY8W6ytg+xDHMyJXf/5RSRP4JBBOKuuKFNv5EfKNWLIR0XW6wjrsg8DDCDcpPZjYptuJKvv9R5CJhc1rRx0z7C+pnoKCV68lw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715599168; c=relaxed/simple; bh=D7rNxISVW39MhcpOP+VwuzECmODJNMC2uz6SkfFgig8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bb0gxN0qV7DtHC9m9GC+7ebI0USXulUCxLq/N++rAd13ijBPX6T/Iyo/kG8pMs5GrPqULmY+gLtJDpFNl51dmDW6/7sVWLwIylyNwSIrkbePBciuWNr5sjk9mlVmanxXEIygNRbMHIBtisKn0HAzl4sarrRZNy19oeyWCM7e/+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=LLskMZLo; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id 45F111C0002; Mon, 13 May 2024 11:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715599162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gKVOMxd20VDSKzHJcmThHdOq/cAuIl6aUIXNfYUiTgQ=; b=LLskMZLonnaI268MC2Xt6BbpwnLc9evFKKmQrTkPQApcjiBoH5mqjIq8rIv2wnEK2rOeUl dMb0mU/XK31GAtE4WKIbC/lpiulpVvXXeQyuySDg1d0YTCWXPSWfyYyRmDlALc/h7Xybl4 mK76KNb/DPLMhIkDjmfoevShpP+KFbvEv19hgOpLB89Uv/WoBBLlPtN24sL1eVcoFKmJnK skqphk7IjcE9pnfgCqAX2TrfAs18joiOMjBQMzu9M+hRhX60ocbPp6NYJQ5iMC4enX1ZEq ArZ4QX+Qb7FFZBDX6nHvATdu+IjnobvmTtaM02LOZDFJVwXZDABeiwwLWlK5qg== From: Herve Codina To: Herve Codina , Horatiu Vultur , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Allan Nielsen , Steen Hegelund , Thomas Petazzoni , stable@vger.kernel.org Subject: [PATCH net v2] net: lan966x: remove debugfs directory in probe() error path Date: Mon, 13 May 2024 13:18:53 +0200 Message-ID: <20240513111853.58668-1-herve.codina@bootlin.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com A debugfs directory entry is create early during probe(). This entry is not removed on error path leading to some "already present" issues in case of EPROBE_DEFER. Create this entry later in the probe() code to avoid the need to change many 'return' in 'goto' and add the removal in the already present error path. Fixes: 942814840127 ("net: lan966x: Add VCAP debugFS support") Cc: Signed-off-by: Herve Codina Reviewed-by: Andrew Lunn --- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index 2635ef8958c8..61d88207eed4 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -1087,8 +1087,6 @@ static int lan966x_probe(struct platform_device *pdev) platform_set_drvdata(pdev, lan966x); lan966x->dev = &pdev->dev; - lan966x->debugfs_root = debugfs_create_dir("lan966x", NULL); - if (!device_get_mac_address(&pdev->dev, mac_addr)) { ether_addr_copy(lan966x->base_mac, mac_addr); } else { @@ -1179,6 +1177,8 @@ static int lan966x_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, -ENODEV, "no ethernet-ports child found\n"); + lan966x->debugfs_root = debugfs_create_dir("lan966x", NULL); + /* init switch */ lan966x_init(lan966x); lan966x_stats_init(lan966x); @@ -1257,6 +1257,8 @@ static int lan966x_probe(struct platform_device *pdev) destroy_workqueue(lan966x->stats_queue); mutex_destroy(&lan966x->stats_lock); + debugfs_remove_recursive(lan966x->debugfs_root); + return err; } -- This patch was previously sent as part of a bigger series: https://lore.kernel.org/lkml/20240430083730.134918-9-herve.codina@bootlin.com/ As it is a simple fix, this v2 is the patch extracted from the series and sent alone to net. Changes v1 -> v2 Add 'Reviewed-by: Andrew Lunn ' 2.44.0