Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4080217pxp; Tue, 15 Mar 2022 12:06:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYQEwIO47z7GJtPzu44TZ1LTCoIPbkZpAuRrcnQXEA5qlHLvlQNOuoGDshFV4yJZ5NgwX1 X-Received: by 2002:a17:902:ed82:b0:153:85d5:7dff with SMTP id e2-20020a170902ed8200b0015385d57dffmr8334577plj.79.1647371176656; Tue, 15 Mar 2022 12:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647371176; cv=none; d=google.com; s=arc-20160816; b=IkGTzPahPy75ei+cL5QBzTHiLIPHTgwyTJsPke2AG1CHxCRP3X7Vry+M7jI3IqSJ/W S5f3Nfl3sNeu6ZRyJ6/tLyyRUagW3KK4OJm/yQ5ekqxTfwnaRB+0/3v+7+y1nWpYWv2P ufnpySphje4QndETieUa0jYcyl5qgmWyo/yoxqZcOm8qsYS9YbxSFsEdkhoRtUrpJQ2x CcNl0ieRytsQR9gI7tPLPeqlC4Q+pGmIs70Ypf6DR9Lqpl2mYrIHGbv1EJo5WQcv9jZG X+adJgxF6N+y8ZtgcnmCnQn9rjdRyw53eFrjUqNvybgj4/yMiCPcCFFufq1RG3rqJ+Tg OqXg== 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=t3Waafw/+jR+SxqGwohtP4aZNPhLJmETCCUHZtMJXjk=; b=zqUyVOupt1meP5wUzWHdHkoIt3of2Por/G7B0GAZ7CB0S5adZOtSAY70X1+igzGkl4 h9QS78MiMOIOJdIhI61Zr5xcYjY0VPekxFinkbcrEzWospZxuaY2gn4H9QVHOMzR9oqB DEYjHj1e4wjAnGaA4O7Ezknb41j4kAAfEbFe8LsaAZMSx1eOmh8GuxcBaP9gxkk9f2ha D4IdbfB711It9hP5k4fJxcrz2CzXr80m0wvs0b0tVBQi8kuWX7P113lxeWgAJ4CSgZwI 6eCkf29CifFVTcoovQ1j7Jgx/h6y/rlnUGSS/mTIqIOCmZtsX7nFPw2h43imPI7jehLh 9yYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ns7OMWGy; 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 y63-20020a638a42000000b0037c92584e1asi17810098pgd.554.2022.03.15.12.06.02; Tue, 15 Mar 2022 12:06:16 -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=Ns7OMWGy; 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 S238513AbiCNMZz (ORCPT + 99 others); Mon, 14 Mar 2022 08:25:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242470AbiCNMTE (ORCPT ); Mon, 14 Mar 2022 08:19:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C73BC4EA2E; Mon, 14 Mar 2022 05:14:13 -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 ams.source.kernel.org (Postfix) with ESMTPS id E8628B80DF4; Mon, 14 Mar 2022 12:14:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1965C340E9; Mon, 14 Mar 2022 12:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260041; bh=hc9spbBytSU92EZINaMpl0guQyJhMUmjbBMFALGkpcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ns7OMWGytlffaMqdVMtUYyf9lb1b61Wo+LTpAJkDiMNweiyHWLSnl5GeFuGocppvj cehLtKYTbZ3frn1LSDz9NwXvDOQB+2LvLEpIZ1r+lODXH6ubLeRBCdo1YWC0s0EtIz Ows7plRjf4wBBCYiEn5yRnAPEoD3i3Jk7grGBbW4= 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.16 039/121] ethernet: Fix error handling in xemaclite_of_probe Date: Mon, 14 Mar 2022 12:53:42 +0100 Message-Id: <20220314112745.220353198@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@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 0815de581c7f..7ae67b054191 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c @@ -1186,7 +1186,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, @@ -1194,6 +1194,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