Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp950416pxp; Wed, 16 Mar 2022 22:22:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7LHO0PiZg56tEbboi3MSiPoTfHrSZ6q1AdFzcXBfgW5lmiRdRzxiijliLQ6bHMW7UkeWN X-Received: by 2002:a17:902:b410:b0:14b:e53:7aa0 with SMTP id x16-20020a170902b41000b0014b0e537aa0mr2974684plr.101.1647494570714; Wed, 16 Mar 2022 22:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647494570; cv=none; d=google.com; s=arc-20160816; b=WUXlI8tAqcbCAEKVvaK6077dumzlvuapJjtuHYOuKE5gqINVzj/IHsxqNQ6D+QGKIz eu9cpQioEZTFGJN1WeF1oygIyd93UlB8HH74r6JEqk2YL4VA8NTQ0a8iVVs9oo9OsE1s ZH/rJmxAwqQyzXNkSFlekz7nQa8cipZhYlyCiYsfxeVQA12MbxQ9KnucogzEx4rgfeeB /tNguV+IqTcwcXVLDNe2L80Dd8taZFK/bV2jEy/GONT75Eowe4RNbCUrd0fkNgckD81O N9+jhv4ih/pD13AoNGm7r1bKQOGp7GWEGYtW+EhOlgaiZ/3gsxU/sxIBqsrK9E37tyDQ 30fQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g/cUY8rdMhRWPZFfeZZt79Nma/qf8kqCQGZsHq4SSe0=; b=Y/EJ9xwf/EvVbUQzqnMXW00b2GLaxFk4c83nPARZkhvtloCf25dvKf7O71UX3Wfi0B JlmqJ4MDohYuugtWOx8ZEWRK8E16VUHbxwcNlADnOWmNQFW81wuzJWxa4mQGcKr4jMm4 5U7VCqAiLEshO/Hv6UkgAF6bP/t2kVXwZwuQ1YMLo7alD+L8ISiyYWM2xBw7QP85EYOn CuH6mvFXC/N0W51Oqfi2QXtNZ5aaaSUgcW3YEHABgd317bgkf08Yo+t6v9BtOOV1Ay5V hwJEQ8ETBtPdKEanZ2+zNBUfamZBW31MOgpOCZeDF2t+MNpUrDdLoXV6f+vpII4ExB9s kkCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CVRcyxIE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c17-20020a170902d49100b00153a66765f5si3878230plg.368.2022.03.16.22.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:22:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CVRcyxIE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AEB6F20C198; Wed, 16 Mar 2022 21:28:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241844AbiCNMSa (ORCPT + 99 others); Mon, 14 Mar 2022 08:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242314AbiCNMJv (ORCPT ); Mon, 14 Mar 2022 08:09:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E5F013EA6; Mon, 14 Mar 2022 05:07:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 53C2F6130D; Mon, 14 Mar 2022 12:07:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CC65C340E9; Mon, 14 Mar 2022 12:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259622; bh=K0Zfy3TQifKqnpEDApkGb4MJ3KxVp4amKIB/i6G30+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CVRcyxIEqyhwXZ9D/vGnZJ9fTsvxRk8vqVK/0dL9Bocs4AJVqaDWIaa5KKNJfFrvu MVUDJRJi5d4h4wrykOpLxGZkriry4DIRnJHHMkHma/0IxjTU1zCiv/6VwdIrRyBWPb B0NgmzKPT6Jdf1KKz8ScqH8p8/znNosq4+U9Id/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 034/110] ethernet: Fix error handling in xemaclite_of_probe Date: Mon, 14 Mar 2022 12:53:36 +0100 Message-Id: <20220314112743.990351778@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Miaoqian Lin [ Upstream commit b19ab4b38b06aae12442b2de95ccf58b5dc53584 ] This node pointer is returned by of_parse_phandle() with refcount incremented in this function. Calling of_node_put() to avoid the refcount leak. As the remove function do. Fixes: 5cdaaa12866e ("net: emaclite: adding MDIO and phy lib support") Signed-off-by: Miaoqian Lin Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220308024751.2320-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/xilinx/xilinx_emaclite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index b780aad3550a..5524ac4fae80 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c @@ -1185,7 +1185,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev) if (rc) { dev_err(dev, "Cannot register network device, aborting\n"); - goto error; + goto put_node; } dev_info(dev, @@ -1193,6 +1193,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev) (unsigned long __force)ndev->mem_start, lp->base_addr, ndev->irq); return 0; +put_node: + of_node_put(lp->phy_node); error: free_netdev(ndev); return rc; -- 2.34.1