From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7CA67C87FD2 for ; Thu, 24 Jul 2025 15:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4bwhBdQjNmSUaoh63Awxos5h/Fzyi1MfJ962AMAviBo=; b=GpGaNXkIAB14zh R39Y/qIpq9fFJkPOl5MnifTUzV16tBs0OTbiaYYM5jzrmimoKr3kETK1JHpuSG3Cat1r01fV5UzD5 q6jjpWiqBN5Qb0iiKN3s+xH9K/UyS3WFP/1qafsQBGEUxxWtMzH6ca0OWaaIGmRs7lAG0g1zdtW9U PAXD7lBN1sh/1oejkFr5rbsp5m671p1+gAYJNbfKD1D9qIH0vDV4aZwVsf+WRYpwoFtKSPN96HGzy YRo1atogFIAEvQ8Gw/JWd/Q6GuOx+cUCBkQzpfhxgcv6P2pvsQa3Bp9hhsAsIEr86boRbRhk9a8xz V1XYRA8BZBhTkibSaGkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uexpC-00000007qKX-13bw; Thu, 24 Jul 2025 15:25:38 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uevkJ-00000007UFp-1Qmw for linux-phy@lists.infradead.org; Thu, 24 Jul 2025 13:12:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 514B3464BB; Thu, 24 Jul 2025 13:12:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 304B2C4CEF5; Thu, 24 Jul 2025 13:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753362746; bh=DqDisvUI7fPFycDWsUDlI/ksWHfJtT5+KAlRMyouAc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tjAEzzz4+teYNLIHuorMBoN50S9frIBjrrKydIwPqisvpjzXvdBVPXHywWNJjqTjj f24HAN4kFKjbGw87cUWQ5W8MeXh45U3DzcMVifDcJOlidjdrPAE+B0Df4qj2+MQy5v sWxfW3WBICyi6b3x757+H0zvP0XWkUHxQ1xV09lK4TG5O+OSTx25pNI1VJnhTo/3pd SFAOkqWsaS5NKPyXyk/ef9NTzrWVaFWfJcQJesalbiUId+go8WF9pAF1/ENI2LHzKE ARkSPQAHDjhOjs0qGZrOjDlN0BTTg4vWz98H92BzaB7ecM41g0/Hc3H9xxPfaY4iaA 9PnJCeUxWCIhQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1uevkD-000000000aH-2enV; Thu, 24 Jul 2025 15:12:21 +0200 From: Johan Hovold To: Vinod Koul Cc: JC Kuo , Kishon Vijay Abraham I , Thierry Reding , Jonathan Hunter , linux-phy@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 1/3] phy: tegra: xusb: fix device and OF node leak at probe Date: Thu, 24 Jul 2025 15:12:04 +0200 Message-ID: <20250724131206.2211-2-johan@kernel.org> X-Mailer: git-send-email 2.49.1 In-Reply-To: <20250724131206.2211-1-johan@kernel.org> References: <20250724131206.2211-1-johan@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250724_061227_409031_9FA1AEDA X-CRM114-Status: GOOD ( 11.56 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Make sure to drop the references taken to the PMC OF node and device by of_parse_phandle() and of_find_device_by_node() during probe. Note the holding a reference to the PMC device does not prevent the PMC regmap from going away (e.g. if the PMC driver is unbound) so there is no need to keep the reference. Fixes: 2d1021487273 ("phy: tegra: xusb: Add wake/sleepwalk for Tegra210") Cc: stable@vger.kernel.org # 5.14 Cc: JC Kuo Signed-off-by: Johan Hovold --- drivers/phy/tegra/xusb-tegra210.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c index ebc8a7e21a31..3409924498e9 100644 --- a/drivers/phy/tegra/xusb-tegra210.c +++ b/drivers/phy/tegra/xusb-tegra210.c @@ -3164,18 +3164,22 @@ tegra210_xusb_padctl_probe(struct device *dev, } pdev = of_find_device_by_node(np); + of_node_put(np); if (!pdev) { dev_warn(dev, "PMC device is not available\n"); goto out; } - if (!platform_get_drvdata(pdev)) + if (!platform_get_drvdata(pdev)) { + put_device(&pdev->dev); return ERR_PTR(-EPROBE_DEFER); + } padctl->regmap = dev_get_regmap(&pdev->dev, "usb_sleepwalk"); if (!padctl->regmap) dev_info(dev, "failed to find PMC regmap\n"); + put_device(&pdev->dev); out: return &padctl->base; } -- 2.49.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy