mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mailbox: arm_mhuv3: fail frame init if cleanup cannot be registered
@ 2026-11-29 13:44 Jiawen Liu
  2026-11-29 19:32 ` Cristian Marussi
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-11-29 13:44 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Jassi Brar; +Cc: linux-kernel, linux-arm-kernel

For an AutoOp Full frame, mhuv3_frame_init() asserts OP_REQ and then
registers a devres action that withdraws the request. If registering the
action fails, the reset helper clears OP_REQ immediately, but the ignored
error lets probe continue and publish the mailbox controller.

Propagate the registration failure so the controller is not registered
after the operational request has been withdrawn.

Fixes: ca1a8680b134 ("mailbox: arm_mhuv3: Add driver")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/mailbox/arm_mhuv3.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/arm_mhuv3.c b/drivers/mailbox/arm_mhuv3.c
index e4140005a662e..5d101c6d7df37 100644
--- a/drivers/mailbox/arm_mhuv3.c
+++ b/drivers/mailbox/arm_mhuv3.c
@@ -813,7 +813,7 @@ static void mhu_frame_cleanup_actions(void *data)
 static int mhuv3_frame_init(struct mhuv3 *mhu, void __iomem *regs)
 {
 	struct device *dev = mhu->mbox.dev;
-	int i;
+	int ret, i;
 
 	mhu->ctrl = regs;
 	mhu->frame = readl_relaxed_bitmask(&mhu->ctrl->blk_id, id);
@@ -838,7 +838,10 @@ static int mhuv3_frame_init(struct mhuv3 *mhu, void __iomem *regs)
 	/* Request the PBX/MBX to remain operational */
 	if (mhu->auto_op_full) {
 		writel_relaxed_bitmask(0x1, &mhu->ctrl->x_ctrl, op_req);
-		devm_add_action_or_reset(dev, mhu_frame_cleanup_actions, mhu);
+		ret = devm_add_action_or_reset(dev, mhu_frame_cleanup_actions,
+					       mhu);
+		if (ret)
+			return ret;
 	}
 
 	dev_dbg(dev,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mailbox: arm_mhuv3: fail frame init if cleanup cannot be registered
  2026-11-29 13:44 [PATCH] mailbox: arm_mhuv3: fail frame init if cleanup cannot be registered Jiawen Liu
@ 2026-11-29 19:32 ` Cristian Marussi
  0 siblings, 0 replies; 2+ messages in thread
From: Cristian Marussi @ 2026-11-29 19:32 UTC (permalink / raw)
  To: Jiawen Liu
  Cc: Sudeep Holla, Cristian Marussi, Jassi Brar, linux-kernel,
	linux-arm-kernel

On Sun, Nov 29, 2026 at 05:44:46PM +0400, Jiawen Liu wrote:
> For an AutoOp Full frame, mhuv3_frame_init() asserts OP_REQ and then
> registers a devres action that withdraws the request. If registering the
> action fails, the reset helper clears OP_REQ immediately, but the ignored
> error lets probe continue and publish the mailbox controller.

Hi,

> 
> Propagate the registration failure so the controller is not registered
> after the operational request has been withdrawn.
> 
> Fixes: ca1a8680b134 ("mailbox: arm_mhuv3: Add driver")
> Signed-off-by: Jiawen Liu <1298662399@qq.com>
> ---
>  drivers/mailbox/arm_mhuv3.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mailbox/arm_mhuv3.c b/drivers/mailbox/arm_mhuv3.c
> index e4140005a662e..5d101c6d7df37 100644
> --- a/drivers/mailbox/arm_mhuv3.c
> +++ b/drivers/mailbox/arm_mhuv3.c
> @@ -813,7 +813,7 @@ static void mhu_frame_cleanup_actions(void *data)
>  static int mhuv3_frame_init(struct mhuv3 *mhu, void __iomem *regs)
>  {
>  	struct device *dev = mhu->mbox.dev;
> -	int i;
> +	int ret, i;
>  
>  	mhu->ctrl = regs;
>  	mhu->frame = readl_relaxed_bitmask(&mhu->ctrl->blk_id, id);
> @@ -838,7 +838,10 @@ static int mhuv3_frame_init(struct mhuv3 *mhu, void __iomem *regs)
>  	/* Request the PBX/MBX to remain operational */
>  	if (mhu->auto_op_full) {
>  		writel_relaxed_bitmask(0x1, &mhu->ctrl->x_ctrl, op_req);
> -		devm_add_action_or_reset(dev, mhu_frame_cleanup_actions, mhu);
> +		ret = devm_add_action_or_reset(dev, mhu_frame_cleanup_actions,
> +					       mhu);
> +		if (ret)
> +			return ret;

That is certainly a good point...on one side the operational mode is no
more asserted as desired on error, BUT also the devm_ failure can only
be due to memory exhaustion AFAICS, so we are probably doomed anyway
at this point.

I would add a noisy dev_err to flag this error more easily.

Thanks,
Cristian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-29 19:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 13:44 [PATCH] mailbox: arm_mhuv3: fail frame init if cleanup cannot be registered Jiawen Liu
2026-11-29 19:32 ` Cristian Marussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®