From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8AE6D320CAB; Mon, 18 Aug 2025 13:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755524667; cv=none; b=TqNAsOJgL61hN782IrSvDDVIP/oxqNnNiUb72xEEBSceY+GE2bcbE5BulODEkyvL8WEoQ+nTDPBEZg5ZTWNyQACaiUyz09u6rOPWw3ZldlOTfBZyfA09sS8bNvlxfBy6QA+2E0M5ad0r9n8QoP73XRq91YX7zfKrhlutb8F7ncM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755524667; c=relaxed/simple; bh=TCVIEVQpSKmo9fk9gSGyHfcO5UWudAVbTdpoMpBCeCk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SIrt75+0UXMgp9G0f+e8V8A7FBs8cI8i4FkbvY3s5PSdKs7I6epvQ92sflIdX1ngZ2E0Vp1AkONPMV16MCa8nr9Y4S2rOiL9o+SrB3CHo9d+PRzUtTQDUM+WNLXYK/+CLHGdlLotoKM7mz8wCnvNBpddDLP0JQubnKphx3rc4/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bFvT01sY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="bFvT01sY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F27D7C4CEEB; Mon, 18 Aug 2025 13:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755524667; bh=TCVIEVQpSKmo9fk9gSGyHfcO5UWudAVbTdpoMpBCeCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFvT01sY8E8YxMUV+IP0H+8bhujAqnItWcOdHXiZERY+AOsSl58xR/bJOQxZB2CtV DWQz2HXI1H2EKcWa1z/gVU75mX9H+GaB+GapVjJTl/NkafsyJeZpVdD208UHK5CuSt bRYsv8l9T8DD849MTpONusfaUozH7zzH7VZTY60A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vladimir Oltean , Johan Hovold , Simon Horman , Jakub Kicinski Subject: [PATCH 6.16 025/570] net: enetc: fix device and OF node leak at probe Date: Mon, 18 Aug 2025 14:40:12 +0200 Message-ID: <20250818124506.784353653@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250818124505.781598737@linuxfoundation.org> References: <20250818124505.781598737@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 70458f8a6b44daf3ad39f0d9b6d1097c8a7780ed upstream. Make sure to drop the references to the IERB OF node and platform device taken by of_parse_phandle() and of_find_device_by_node() during probe. Fixes: e7d48e5fbf30 ("net: enetc: add a mini driver for the Integrated Endpoint Register Block") Cc: stable@vger.kernel.org # 5.13 Cc: Vladimir Oltean Signed-off-by: Johan Hovold Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250725171213.880-3-johan@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -829,19 +829,29 @@ static int enetc_pf_register_with_ierb(s { struct platform_device *ierb_pdev; struct device_node *ierb_node; + int ret; ierb_node = of_find_compatible_node(NULL, NULL, "fsl,ls1028a-enetc-ierb"); - if (!ierb_node || !of_device_is_available(ierb_node)) + if (!ierb_node) return -ENODEV; + if (!of_device_is_available(ierb_node)) { + of_node_put(ierb_node); + return -ENODEV; + } + ierb_pdev = of_find_device_by_node(ierb_node); of_node_put(ierb_node); if (!ierb_pdev) return -EPROBE_DEFER; - return enetc_ierb_register_pf(ierb_pdev, pdev); + ret = enetc_ierb_register_pf(ierb_pdev, pdev); + + put_device(&ierb_pdev->dev); + + return ret; } static const struct enetc_si_ops enetc_psi_ops = {