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=1796153038; b=Bdx2UxahYGm6l85N8H6WduRbUL8O3Slc/bMxNOePlQj+N9G3KE23z3txZtl2EOM1MLKg CAF4gHELAzkWdArcXTN+G4c/Hq7Z1r4gksUFZWq+ebn06emRIaVtU4ZxboGYlyOpS7WPS ct+MANyLODzlN6CzxqOWiXhhJ54Ep+nVMpoTaOf/VqWfF/w6+sH8x90ZN1qtF9zyY0hho esTgp04Bvz1Mz5W088Sh53nLZ+TQu8B6yv4gnpR+xToJCL5DRUfH3V3dZDjRVMunpICBA BjIBvF/pquOzVnn+UC3JY/UHtQcPxjVDYhGP6NyXNCyYwYe2y8g5ZE4x+UMA0ube3lg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796153038; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=cZbYpCtfQ4nxnsLpqCBnxRML+1U35BlyT9f8Fdtptt0=; b=OwSqI9OuyKlkc/gl+vTRrzQHTdCB3GSXzig/+U3EYZWL3lpV8UidxRjYybUghblxSdvE MbtLo004DcdqqlG2IpqqXc19Hy6ilpGwtanjxd3qA4h7+mQO6/MhXpaXDHOP+RB874UV4 7tW/adlOMaoovB0Q3c8QTjMJYa5+OkpMTDz/bWuiQlCiYIMrKhuceXxBLr6FHwZcB4FsT 6TFAKT3RG7rh+RQcQB08jf0Qn6oPzpoFRiL/96URmWkEiwOUaB5EOPL0P53LYzRY3sPI4 E7DVgyRdMTye28L/8FWb5rVYe+uiewE5IqRHhlXvR86YsHtrCoS3+j2q+pb9yXUPGLA== 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=huMuztWX; 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 4F546606A320 for ; Tue, 1 Dec 2026 19:23:58 +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=huMuztWX Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68F11F000C1; Tue, 1 Dec 2026 19:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796153037; bh=cZbYpCtfQ4nxnsLpqCBnxRML+1U35BlyT9f8Fdtptt0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=huMuztWXPND8va1OxzCWgfC6lZ+dQjzm9JAxJtbkazRm3PwTlKshV3ghscMlvgyQk b0LqqQhyTaEIhBXr6uuwW2i+MoV9m5bM1BeX4/WdSP8XCb/Wc2CAMOfTjslzqvg2bi lQs/VmCqEk93yfttjU1/d3hxek1PkAmQUfJfB5KGY4K7XM1DmqzdmM0y6PcQVeHqg0 PcIQQw//DlUnF0A5gZmbulN7K8Dhsl3SXulh/pa2YpoXER1d66LtiNOlCW0rUt/DAO PNkUu/NI/ySZkMCb+t9sXAM2/4wlf3cvQ5+HjXCHZEu24EeL7NFpKdXGyMRpzc7/8T 3JyhwUKuCGDBg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] serial: uartlite: Undo clock and runtime PM setup on probe failure Reply-To: sashiko-reviews@lists.linux.dev To: "Arina Kharlamova" Cc: linux-serial@vger.kernel.org In-Reply-To: <20261201-s2p-tty1-v1-2-731a5142143c@mbzuai.ac.ae> References: <20261201-s2p-tty1-v1-0-731a5142143c@mbzuai.ac.ae> <20261201-s2p-tty1-v1-2-731a5142143c@mbzuai.ac.ae> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 19:23:57 +0000 X-Mailing-List: linux-serial@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 no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] serial: uartlite: clock underflow and wrong teardown order in ulite_remove() [1] -- commit 836e2a7f4a7eacabfa56b7b7ef2b7ad0fda56104 Author: Arina Kharlamova serial: uartlite: Undo clock and runtime PM setup on probe failure This commit disables runtime PM, drops the runtime PM usage count, and disables and unprepares the clock when ulite_assign() fails in ulite_probe(). > diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c > index b9a14dc2f2fdf..d2dfdfde72a25 100644 > --- a/drivers/tty/serial/uartlite.c > +++ b/drivers/tty/serial/uartlite.c > @@ -881,6 +881,13 @@ static int ulite_probe(struct platform_device *pdev) > pm_runtime_enable(&pdev->dev); > =20 > ret =3D ulite_assign(&pdev->dev, id, res->start, irq, pdata); > + if (ret) { > + pm_runtime_disable(&pdev->dev); > + pm_runtime_set_suspended(&pdev->dev); > + pm_runtime_put_noidle(&pdev->dev); > + clk_disable_unprepare(pdata->clk); > + return ret; > + } > =20 > pm_runtime_mark_last_busy(&pdev->dev); > pm_runtime_put_autosuspend(&pdev->dev); [Severity: High] This problem wasn't introduced by this patch, but can ulite_remove() [1] underflow pdata->clk and access ULITE_CONTROL with the clock gated? drivers/tty/serial/uartlite.c:ulite_remove() { struct uart_port *port =3D dev_get_drvdata(&pdev->dev); struct uartlite_data *pdata =3D port->private_data; clk_disable_unprepare(pdata->clk); ulite_release(&pdev->dev); pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev); } When the port is runtime-suspended at driver unbind, the pm_runtime_get_sync() / pm_runtime_put_sync() cycle in __device_release_driver() immediately re-suspends the device via ulite_runtime_suspend(), which calls clk_disable(pdata->clk). Calling clk_disable_unprepare(pdata->clk) unconditionally at the start of ulite_remove() then disables an already disabled clock. Disabling and unpreparing pdata->clk before ulite_release() calls uart_remove_one_port() also leaves the AXI clock gated when ulite_shutdown() accesses ULITE_CONTROL, and causes child serial-base unregistration to call clk_enable() on an unprepared clock in ulite_runtime_resume(). In addition, ulite_release() clears drvdata with dev_set_drvdata(dev, NULL) before pm_runtime_disable() runs, so a concurrent runtime PM callback can dereference a NULL port pointer from dev_get_drvdata(). [1] https://sashiko.dev/#/bug/linux-f6fc2c71-7926-4155-b602-d912aee2abb8 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-s2p-tty1-v= 1-0-731a5142143c@mbzuai.ac.ae?part=3D2