From patchwork Thu Jan 12 16:13:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 42522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3971114wrt; Thu, 12 Jan 2023 08:18:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXsnCYp5cVS3jCU3ol9rSBfeqO1TNqVvV2gQr723hiL77sBCeOQmGe8XUczjuv3K5prqXPvX X-Received: by 2002:a05:6402:4150:b0:47e:1b4a:5491 with SMTP id x16-20020a056402415000b0047e1b4a5491mr66719928eda.20.1673540329025; Thu, 12 Jan 2023 08:18:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673540329; cv=none; d=google.com; s=arc-20160816; b=e8ZuXGXZQftJQEMMHHPTT30a7g1z5kEWH+GdzwxM9n6YdtAMnWhCoCFVa5UhV88OFs 3o0xtQPRINKWUuActYNJ8ilXb1Rz/0CEoAKtNYEgYbdLlqKUbrrQE1b7JtT4HKrCz/o2 HZLqlChjDQyrEZIuli+Affx/yzyJbCWHLQVfCE/k8x+ZaKplQK0vSkKNTrQhnUhJPbBd s09o4etNmgVk930dZqSxhujXSxJuJ5J2Ku420knA34azG4XhUVXkGtCPJnAQZSMN53xd yh8bJfr1z+33IN67Z8KBKxt8kzUomRHG8pF7ugg0AED6Zn8XtUKA2E7C3jOiCF9UwNML xwyA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xxLaGegYQm28LPQufEzUPjtyh2y4iexg9LenfhO2O48=; b=tBVHZ8KrqZfIrlgDGoFQytOBqymjcqN9VIS3zRMrZLOx78g3eMMaB+oPicDWdrAaNW TAv5NIEwkReZyWrDEEwRs1T7Ps7f0FSKwCHPX9SigYgfDLI0OvX9PeAlP/JjGYssr0wI qmWtcOvKc/FCsBdaadjGFZoUGhVsYOO8/ZyFgAXPhztKsYDf9aFrCUkjygNHJLlj2PWy +Q8bYjgjJAwAmA7W+h4JQAH2NmZXwmsFlgAihPGmqTqtPK67WOt9YFYKEpLTycQibCOp Mg6GlswgR0gr/V34sEw25Ssl9il8/LgNdq9DU0vE/pr0KfPlK7EacNsFEOC70ds10+B1 yJAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EqqUksdz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a05640234d200b00486c1b099d5si22701250edc.3.2023.01.12.08.18.25; Thu, 12 Jan 2023 08:18:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EqqUksdz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231350AbjALQPI (ORCPT + 99 others); Thu, 12 Jan 2023 11:15:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239847AbjALQNo (ORCPT ); Thu, 12 Jan 2023 11:13:44 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88307FF9; Thu, 12 Jan 2023 08:11:10 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 067DFE000A; Thu, 12 Jan 2023 16:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1673539868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xxLaGegYQm28LPQufEzUPjtyh2y4iexg9LenfhO2O48=; b=EqqUksdz+Wxq6Gb1gYEudLrOKAe6EUtL7snjY2ALGo/XyVZWK5kbc0Ci4x8VjqIjS6I0MJ wku7KgfrCf9VXTh6JS+da4MAe7Tq/tl3U+toTpiTxnoj+zROPElOn/sDeOuzRSdvJsIt96 j1xGSq/GcSW+ffjsAnbE2fxVgQPnc2RBEKanRokilGdBGhV5m0y4Hf3nNiHVekdUAGAaly +Ut4rcW5AlyuvCW7OoWilecspetpaxhjWasBYkcoVVfefKKHh1Hs/8rWvkf4cvM8nA+Vvi 7MwwPRxupXsRs+iSB7+aWxer4JfV1ii+4tn4wTzhBYtf1Yyga4hI/POh2QLxZQ== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Horatiu Vultur , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] net: lan966x: add missing fwnode_handle_put() for ports node Date: Thu, 12 Jan 2023 17:13:11 +0100 Message-Id: <20230112161311.495124-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754834224347319964?= X-GMAIL-MSGID: =?utf-8?q?1754834224347319964?= Since the "ethernet-ports" node is retrieved using device_get_named_child_node(), it should be release after using it. Add missing fwnode_handle_put() and move the code that retrieved the node from device-tree to avoid complicated handling in case of error. Signed-off-by: Clément Léger Reviewed-by: Alexander Duyck --- .../net/ethernet/microchip/lan966x/lan966x_main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index cadde20505ba..580c91d24a52 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -1043,11 +1043,6 @@ static int lan966x_probe(struct platform_device *pdev) lan966x->base_mac[5] &= 0xf0; } - ports = device_get_named_child_node(&pdev->dev, "ethernet-ports"); - if (!ports) - return dev_err_probe(&pdev->dev, -ENODEV, - "no ethernet-ports child found\n"); - err = lan966x_create_targets(pdev, lan966x); if (err) return dev_err_probe(&pdev->dev, err, @@ -1125,6 +1120,11 @@ static int lan966x_probe(struct platform_device *pdev) } } + ports = device_get_named_child_node(&pdev->dev, "ethernet-ports"); + if (!ports) + return dev_err_probe(&pdev->dev, -ENODEV, + "no ethernet-ports child found\n"); + /* init switch */ lan966x_init(lan966x); lan966x_stats_init(lan966x); @@ -1162,6 +1162,8 @@ static int lan966x_probe(struct platform_device *pdev) goto cleanup_ports; } + fwnode_handle_put(ports); + lan966x_mdb_init(lan966x); err = lan966x_fdb_init(lan966x); if (err) @@ -1191,6 +1193,7 @@ static int lan966x_probe(struct platform_device *pdev) lan966x_fdb_deinit(lan966x); cleanup_ports: + fwnode_handle_put(ports); fwnode_handle_put(portnp); lan966x_cleanup_ports(lan966x);