From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 EA6723B05A4; Fri, 7 Aug 2026 14:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786114748; cv=none; b=mGXkX+5ZdATMfdm5fS/kiyQXRz6EbM58czhien+Q5pemtKhE6g5tLnRgHCen52ESRqb3kbgw6QCBucuJUhQjnniKD7lgv2NNhAoQImSWf8ASzyT1+t8a2r+uaKT25fgnJERRmdk9TeQVj56/Mz0MY3rAeMn4LgH1Vnpigkd77EI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786114748; c=relaxed/simple; bh=FDcU6DAbWBOiACJ+/GS9Hrg291uL1lr9To1o3G/nlU0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JWVja/oWvKFVz5RlfSUoQQ/kB84a/b0d4Ii4E5GbfJAAS+LOsjTCgrxxmj05ugGAUh3bLMcw0fCMJgzmlZaQxMKXfXwA8iIyf/gsqq3RrMIUisEy5TAqSA9bH2iRvemvMSv7lgyrjJ7aB5U+KPFwecl/wmIYrz5eKhmweco3reM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L2h5ig4T; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="L2h5ig4T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5267E1F00A3A; Fri, 7 Aug 2026 14:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786114746; bh=NKtCmw8eLONM/KVGu+zmqXVQzg2hlMUniM6+nML3D/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=L2h5ig4TBCt4YtpR3wJ30IYxWguw8+6rdOtKhEfjVk4oURQcuXcQ9QrXOVHy7vfht 9WUrYGGcc0MliXi3A3tUCbkAgkrZqZmIxQk3TdBcNNdmr1juLfktsvwLcQQQv4bkZY Noi32aci959OZ4LmNHWngZJWXWEgvAeHOrfVGCpA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Radhey Shyam Pandey , Michal Simek , Vinod Koul , Sasha Levin Subject: [PATCH 6.18 033/396] phy: zynqmp: fix runtime PM leak on probe allocation failure Date: Fri, 7 Aug 2026 16:33:13 +0200 Message-ID: <20260807143424.987549905@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143424.272339768@linuxfoundation.org> References: <20260807143424.272339768@linuxfoundation.org> User-Agent: quilt/0.69 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Radhey Shyam Pandey [ Upstream commit f3506e15cf72e94f62d5f2d173e5b7008f644cde ] Allocate saved_regs before pm_runtime_resume_and_get() so a devm_kmalloc() failure does not leave an unreleased runtime PM usage counter. Fixes: 5af9b304bc60 ("phy: xilinx: phy-zynqmp: Fix SGMII linkup failure on resume") Signed-off-by: Radhey Shyam Pandey Reviewed-by: Michal Simek Link: https://patch.msgid.link/20260720153832.1130006-3-radhey.shyam.pandey@amd.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/xilinx/phy-zynqmp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c index c8230f2bda629..2138f5399821a 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -1044,6 +1044,12 @@ static int xpsgtr_probe(struct platform_device *pdev) return PTR_ERR(provider); } + gtr_dev->saved_regs = devm_kmalloc(gtr_dev->dev, + sizeof(save_reg_address), + GFP_KERNEL); + if (!gtr_dev->saved_regs) + return -ENOMEM; + pm_runtime_set_active(gtr_dev->dev); pm_runtime_enable(gtr_dev->dev); @@ -1053,12 +1059,6 @@ static int xpsgtr_probe(struct platform_device *pdev) return ret; } - gtr_dev->saved_regs = devm_kmalloc(gtr_dev->dev, - sizeof(save_reg_address), - GFP_KERNEL); - if (!gtr_dev->saved_regs) - return -ENOMEM; - return 0; } -- 2.53.0