From nobody Sat Feb 7 09:35:10 2026 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B0FC1482E8 for ; Sat, 24 Jan 2026 17:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769275192; cv=none; b=SXhBEy2crYTQUyZWU+AAUpXQm1eJBwVaB1E87sJjcOhlr53etMMsD4bexMM15Mbsjxkd+2rVASmUv/TrOxYDHp3cJGolctuHM0zMRzVsGYs5fOXqce2YV13oxOq0fUZsxlsnKxRbtZUeQ2ccWMS3sm45DDXNnyl3l+qfDPmRqMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769275192; c=relaxed/simple; bh=N8BJ2XoL6RWsSMDXgT3y0d3NEwsWENvOGYzbokKPriQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=CNIMI81+5QYiLWyds08KUkFPu8pQd7PgLEg/HCuXXwXPT4RP1YClna/6dreOvjylqD4FIJKlB++Fyxdxf3TUrP9u4VG95POdHZdruccxxzHXCSKbRkVW/CuFE7IDwUfhC5rimHtq4clqZFL3m/n2edNE+eQ1YbNz5q6w7A5klIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TcVS2XyL; arc=none smtp.client-ip=209.85.222.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TcVS2XyL" Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-8c6af798a83so362401285a.0 for ; Sat, 24 Jan 2026 09:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769275190; x=1769879990; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=hu27MEk2joWcihG8erKat/1jVTiWwwVOoOBwBr4PT6E=; b=TcVS2XyLj2V7Yr9AjwtisAmKqO4ZNNczFqYOEvTJzyMWwtArW/j5mdZzwhQvfJcfJZ 90BKAeFi3Lg50KG+FfZYmfwXy0h8igphxQqoqUx4Mk5lskDtQ+I4w63jUGi1IWbhOc2v anQ3iw6VXyKYfr5aHdssAvSEi3aDrA5jQbWcfWEumRLQ9pifG0344DrDFHTYG0vZooTf wTONeek+qoRg/5Odl6HEPdKA5Yc2BOYVvzgyQ0Y0FqWyOAqtCNkPcBEmbVb3j381XeGu HHn7qh90A6rtemC2OglXHN+DGLqRcEjKq8rXIdYdMomV+yWqHDRLRlHLpxFWb58lhPH/ WY3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769275190; x=1769879990; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hu27MEk2joWcihG8erKat/1jVTiWwwVOoOBwBr4PT6E=; b=i5C86jsmqg2ywDtEnhOgs2sJhpaQW0RGG6EZZQGmJfCr/NVSVK1to0GMp59tsIKoCW mwqPRsudvmErdQXfcEdJjdXr06V7+MXdsLW6rJ/wnkgObrj5SrOLXtbtaMcPxsSOu/at r24ruTkvVOJPKe/ZBdzOGZpd2Trdlst36oyHlHMQrBrzi37Dj/yBeprUew2tZXB4d97A l7szf9u/2j+5SwVi3hWB4Zemuupr1EZvJGHOlhl63kYr/S/7xbi7Qu2CP0yq3qtKal8a QHI8TvFoErRMJPHu2cxQ8Azkk9xh6pRBPCBmH7jUQXknI5Dm2NIlS2d/8gW9rj9VinFQ VPhg== X-Forwarded-Encrypted: i=1; AJvYcCVcjBeCKbJcMdSPVtIGEgxuOr4y2p3/5PATHOwQ6fHIm5RZJ7Cb4U13wkU5I110Svfxff13E9WN6Lz5jKs=@vger.kernel.org X-Gm-Message-State: AOJu0YzxcVRyRFeVzV3oSxXxezAMAXD7/ZWGvmQWuFCeSNkWggWbq78Z EcTaJt/PbYSZSFXpMmW6EmknoivHiqya3uvPLdPcugMu6QcOmQ7CgyQS0spYhAZlIg0= X-Gm-Gg: AZuq6aLdau7Ldk09M0+I5Ol49SQCNwt4zR5p+hD0BdGGrZGQ3T/iSlBV5/tVZps9yzR WZlPfWkhXMmG/K2zOD5Yki8v35NLMbXwbyVKZRDBvoLLEwzpLGtv2yYeNDceVcjE1gky+Mgxg7Q Q7Yd9cIRCyIwEi+ROV+u0iP2c7ZDNjAHsHrXhTVKsn1FoE+ShjEFuWo1aWER7LH60nzIcuiIp+b QaLfLx4H+xmIgrH0rF0WzxZhCz24qc/6FuHJ5wBVB982b5IgAvFT0NueTt2DnWMvAgwqGacNX4i OE9CCsYmzcta07bZvroT7Ds/PVqnFgEiP7UgY2ILn7RYXbaWmCXXCnSmVj2zu8Wq5xcwxie+QGH +Bl9rHmXGhy4Dy6QZmeyTSao9XRnfOYm1nz3iJE1ws1zWJZy53MB6dDCtNpmHOHOuN+yoETij62 /ECi6iW0CQlsy8Nf8s+VBXGQSlQpG3oiVCcKQ= X-Received: by 2002:a05:6a00:744e:b0:823:3056:c2e6 with SMTP id d2e1a72fcca58-8233056d753mr1391339b3a.67.1769269376898; Sat, 24 Jan 2026 07:42:56 -0800 (PST) Received: from junjungu-PC.localdomain ([188.253.124.92]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82318666c16sm5093118b3a.24.2026.01.24.07.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jan 2026 07:42:56 -0800 (PST) From: Felix Gu Date: Sat, 24 Jan 2026 23:42:45 +0800 Subject: [PATCH v2] PCI: imx6: Fix device node reference leak in imx_pcie_probe() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260124-pci_imx6-v2-1-acb8d5187683@gmail.com> X-B4-Tracking: v=1; b=H4sIAHTodGkC/23MQQrDIBCF4auEWdeiNtWkq96jhBLUSQZqDFokJ Xj32qy7/B+Pb4fkIrkEt2aH6DIlCksNeWrAzOMyOUa2NkguFReyZauhJ/lNMey11bzrtEUD9b5 Gh7Qd1GOoPVN6h/g55Cx+6x8kCyaYwvaiezRXofh98iO9ziZ4GEopX1OB0H+gAAAA X-Change-ID: 20260124-pci_imx6-f97d70887dfc To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Trent Piepho Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, Felix Gu X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769269369; l=1739; i=ustc.gu@gmail.com; h=from:subject:message-id; bh=N8BJ2XoL6RWsSMDXgT3y0d3NEwsWENvOGYzbokKPriQ=; b=h6ad2YkaTwuh/K5r3ATTlVSOlDZhd2RIYTIws/ygz/DGkZChc07DnBrwAdCZ7SBoQUMA+VBAI YHNWHD+cMCrBBP0h/b47zCHs4WZV2TsrS6/fjuhJKNurMo7ouhPSHlC X-Developer-Key: i=ustc.gu@gmail.com; a=ed25519; pk=fjUXwmjchVN7Ja6KGP55IXOzFeCl9edaHoQIEUA+/hw= In imx_pcie_probe, np is obtained by of_parse_phandle() and must be released when it's no longer needed. However, it doesn't release the reference, which cuases a reference leak. Fix this by using the __free(device_node) cleanup handler to release the reference when it goes out of scope. Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL f= ailure") Signed-off-by: Felix Gu Reviewed-by: Frank Li --- Changes in v2: - Use __free(device_node) clean handler to fix the leak. - Link to v1: https://lore.kernel.org/r/20260124-pci_imx6-v1-1-6f4379fc5160= @gmail.com --- drivers/pci/controller/dwc/pci-imx6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller= /dwc/pci-imx6.c index 1d8677d7de04..f459d05ecd7d 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1643,7 +1643,6 @@ static int imx_pcie_probe(struct platform_device *pde= v) struct device *dev =3D &pdev->dev; struct dw_pcie *pci; struct imx_pcie *imx_pcie; - struct device_node *np; struct device_node *node =3D dev->of_node; int i, ret, domain; u16 val; @@ -1670,7 +1669,8 @@ static int imx_pcie_probe(struct platform_device *pde= v) pci->pp.ops =3D &imx_pcie_host_dw_pme_ops; =20 /* Find the PHY if one is defined, only imx7d uses it */ - np =3D of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0); + struct device_node *np __free(device_node) =3D + of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0); if (np) { struct resource res; =20 --- base-commit: a0c666c25aeefd16f4b088c6549a6fb6b65a8a1d change-id: 20260124-pci_imx6-f97d70887dfc Best regards, --=20 Felix Gu