Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3547737pxp; Tue, 15 Mar 2022 00:22:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLeEoIKSAVT/6EgEIe5qiwAM7CysMU3ulXHgeKK70hAkt2djpFyzjnqzusxMKMIJZ/WKXV X-Received: by 2002:a17:90a:fe14:b0:1bf:a3a0:d212 with SMTP id ck20-20020a17090afe1400b001bfa3a0d212mr3036639pjb.207.1647328971615; Tue, 15 Mar 2022 00:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647328971; cv=none; d=google.com; s=arc-20160816; b=e4QApRVBABS/aQ1tFmD1niVqqt9iWk3GTadBOpEuDXftrIKAXfMfTLJeA4PK6pqf9h mA0kG8PribB8Asb5Jps1hzWxDCA5hXeRG3Klf0MR5QhzTiGGW6gLUDdlYhw+LF/ky+kT KnqDiwKG1p0dCfQSa7y5f1WMzFb51LyMo0/Basy9vrnLal0JAnBauhD7nCQZcGmHzQdQ ONr0b3Fb2tFuyp61u30k2AEnG8fPKUgqU6bYHQG6nLGQN4sr3QTiCh7+Sz+ah7TOm0vH SW849UMmJ6pjF+UBa3PjOAfiTGn76b1PYj//N7c9t19o2r0ZvScbkg4DKYWqih9oZtAF +52Q== 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=WPrpF/yHmBTQ9ItE618d6rxeOiprechn6E7S8dbPRoo=; b=H8aM7phMJEmVYojwE+QOJydPZM9suO3uiPzr7J1RIVXHot6nIdTO5OCn3wtaqF3BvX WMYPrQb8BsKEIkP58g79tlJBAu4XYlL2VVchOadD+OYwAYaZtrtHe6WCHrmi7vth8YSV Mbc0izpYnc4soPwZ4+cX3jrv3t60zKKQJkWRL0nHBgpn1zdnhspKHJsTL8BrRGLMUaRL 2tap5il0r5sf0eD3avCx2aqqfMt5Kjv9K8v78KV3uboloMCAV5fNj29mZMYpAwACLaUs Gkp5v4MdwiIpOOo7RQiRaNX36RLLyv76AwpXHGbvp+a8Bn3XVx4ZpdLNvnQT7kVVHzES dg7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hOntNCU4; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k190-20020a6384c7000000b00381696900c4si613945pgd.261.2022.03.15.00.22.39; Tue, 15 Mar 2022 00:22:51 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=hOntNCU4; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239193AbiCNLle (ORCPT + 99 others); Mon, 14 Mar 2022 07:41:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239490AbiCNLlV (ORCPT ); Mon, 14 Mar 2022 07:41:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C144C49686; Mon, 14 Mar 2022 04:39:04 -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 355F661170; Mon, 14 Mar 2022 11:38:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 020D1C340E9; Mon, 14 Mar 2022 11:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647257933; bh=8kPz8I0Jy7OekAVkb5pKKDLra9sVIDHd+jIlGka8EYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hOntNCU4b8BIj8VJZxUsCdVCsxE9X5PM54na7ju5Po47NH2IcjryEzwsuT3ab65sn dFi6cH6R9mWsjyx8fFsjLgDhYESPHbAhsYoSDbwL+oqWTiafg+PsQA/thxxv+aDiUz mKBJzO99x7CPy/DFASEp8TZp0vuSCacMB4fHaP70= 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 4.19 03/30] ethernet: Fix error handling in xemaclite_of_probe Date: Mon, 14 Mar 2022 12:34:21 +0100 Message-Id: <20220314112731.884416596@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112731.785042288@linuxfoundation.org> References: <20220314112731.785042288@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=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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 edb2215f9993..23a4f9061072 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c @@ -1173,7 +1173,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, @@ -1181,6 +1181,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev) (unsigned int __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