From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795960652; b=pjKUvh0S6d2cRwtLuJI108TlqatN/omrpyMmtcNO6Qs9w4LfHsqY6lywORjJoNROBSP9 tGPVTK3hW3oQSDqVvwciWoW93ue8BI8WqGjzxXBxSGAnELi+WSAhosThWDwtBnKnSLyLr B9qk/5Y2qHuNBK6Fwb0suIT957y0sTAp1hAnIs7jmjUEGpIoYtmq9u3ODE9kgVOmE1uxS BCbqe93BgFuqJPAIeYVRUjpe5DhGbBb/GhPJA4Hy/toUq0a99HyWAvwmROWrjXb+gFGQK fvF5coI4DHe3IbN8TVAq0l6m/ueW4bRAHZ3i6uDiLmZ2oik/cV+KuZUKbxGiEgi8alQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795960652; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=p2+ju4gxXe6s5KRzsP7DS8WXfGSJ5OyXctDe8GYxDn4=; b=jytnBKSzrT+2Vu9H2hd7LR7xI5cEKsE+AP0d6w4ZQl1ozUpRfNcFBnexMBZ51NtMMhLQ avY52uj465cWmuKxKxGbhvXkQFZ2XOQUUWvfa0T4sIDZwsBw5a+FFj0coSxD7TJRPVmVk chbLA2F6Npz1c/KwA+LK9OdLTbbpD947/1H0NsfKQNIbizdWFIWJhPc+V1ebS5cbNyui+ x5b/q0yz05xG3QyWDSViI7vlNyN0R2chVnlDdoEy2vr4M6ZT2l4KgadUbYXyvK9FPwJgV EyOTqIx7exEOqoxGmPFu/3dF4QgL8Rj+UM1pvEU3KSkqgBI+hEhEKhiG/GVOST6NeuQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IO06uqmQ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FBC2606A323; Sun, 29 Nov 2026 13:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IO06uqmQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id A52271F0089B; Sun, 29 Nov 2026 13:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795960652; bh=p2+ju4gxXe6s5KRzsP7DS8WXfGSJ5OyXctDe8GYxDn4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=IO06uqmQssa1Dhr58TAoyz1H8ZiVkBIjHOpMUAxQHLfuQ+1DqbHvLBv34jPCOU8Iw C5sUsPyPL6Og6ud5c+brosGDlY2xYgTaEpgtVZ4S5SfJ9OkZmR80hn04s1ylqxh0WB 5fqe4Ux0ipTgXyOPA09LJkEN4AOYa1elmsHiK0vd1q7ohvnkKAKr7FTzdRCDYmTu7v ByB93tn7kYR0ySzQ9b+9g84OgRr9mtkrOV3kNB5hnVV2tdfbmUWKwYIuQqwBUceFB6 jDXFgWHdE5/lthHt4zyjfA7Q78pGlFkv8b9ybjw5dzAqlaEPtB4fY9z22af+UZN4pd Vs+8tpnQ0jhaw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] hwrng: imx-rngc - fix runtime PM setup failure Reply-To: sashiko-reviews@lists.linux.dev To: "Jiawen Liu" <1298662399@qq.com>, "Olivia Mackall" , "Herbert Xu" , "Frank Li" , "Sascha Hauer" Cc: "Pengutronix Kernel Team" , "Fabio Estevam" , linux-crypto@vger.kernel.org, imx@lists.linux.dev, Frank.Li@kernel.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 13:57:31 +0000 X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] hwrng: imx-rngc: clock leak on devm_hwrng_register() error in imx_rngc_probe() -- commit a90c66e5122e753cea99f489c48d3ebf74c67153 Author: Jiawen Liu <1298662399@qq.com> hwrng: imx-rngc - fix runtime PM setup failure This commit checks the return value of devm_pm_runtime_enable() in imx_rngc_probe() and holds a temporary runtime PM reference around the setup and hwrng registration. > diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/i= mx-rngc.c > index 8dfd7821225c1..948f3ef9e8d69 100644 > --- a/drivers/char/hw_random/imx-rngc.c > +++ b/drivers/char/hw_random/imx-rngc.c > @@ -312,13 +312,21 @@ static int __init imx_rngc_probe(struct platform_de= vice *pdev) > pm_runtime_set_autosuspend_delay(&pdev->dev, RNGC_PM_TIMEOUT); > pm_runtime_use_autosuspend(&pdev->dev); > pm_runtime_set_active(&pdev->dev); > - devm_pm_runtime_enable(&pdev->dev); > + pm_runtime_get_noresume(&pdev->dev); > + ret =3D devm_pm_runtime_enable(&pdev->dev); > + if (ret) { > + pm_runtime_put_noidle(&pdev->dev); > + clk_disable_unprepare(rngc->clk); > + return dev_err_probe(&pdev->dev, ret, > + "Failed to enable runtime PM\n"); > + } > =20 > ret =3D devm_hwrng_register(&pdev->dev, &rngc->rng); > if (ret) { > - clk_disable_unprepare(rngc->clk); > + pm_runtime_put(&pdev->dev); > return dev_err_probe(&pdev->dev, ret, "hwrng registration failed\n"); > } [Severity: Medium] Does replacing clk_disable_unprepare(rngc->clk) with pm_runtime_put() leak rngc->clk when devm_hwrng_register() fails? imx_rngc_probe() enables rngc->clk manually with clk_prepare_enable() and relies on imx_rngc_suspend() to disable it during devres teardown. When CONFIG_PM is disabled, devm_pm_runtime_enable() and pm_runtime_put() are no-ops and imx_rngc_driver.driver.pm is NULL via pm_ptr(), so imx_rngc_suspend() never runs and rngc->clk stays prepared and enabled. Even with CONFIG_PM enabled, pm_runtime_put() only schedules asynchronous autosuspend. If the autosuspend timer fires and queues RPM_REQ_AUTOSUSPEND before pm_runtime_disable_action() runs, rpm_idle() in pm_runtime_dont_use_autosuspend() returns -EAGAIN and pm_runtime_disable() cancels the pending work item without running imx_rngc_suspend(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/tencent_E83A64A52E8= D1310A0E3AF63A564FD441106@qq.com?part=3D1