Re: [PATCH] mailbox: sun6i: modernize probe and convert to fully managed

[email protected] Mon, 27 Jul 2026 19:48:42 +0000
Newsgroups dev.linux.lists.linux-sunxi
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The function `devm_mbox_controller_register()` is called with one argument, but it requires two, causing a build failure.
--

--- Patch [1]: [PATCH] mailbox: sun6i: modernize probe and convert to fully managed ---
commit 6febca9f53cbed2f1affb7635d88de86beffdca8
Author: Rosen Penev <[email protected]>

mailbox: sun6i: modernize probe and convert to fully managed

This patch replaces manual resource cleanup with devres-managed variants in
the sun6i mailbox driver. It converts IRQ, MMIO, clock, and mailbox
controller registration to use their devm_* equivalents and removes the
manual error paths and remove callback.

> diff --git a/drivers/mailbox/sun6i-msgbox.c b/drivers/mailbox/sun6i-msgbox.c
> index 6ba6920f4645e..28d8636afad26 100644
> --- a/drivers/mailbox/sun6i-msgbox.c
> +++ b/drivers/mailbox/sun6i-msgbox.c
[ ... ]
> @@ -271,29 +267,8 @@ static int sun6i_msgbox_probe(struct platform_device *pdev)
>  	mbox->controller.txpoll_period = 5;
>  
>  	spin_lock_init(&mbox->lock);
> -	platform_set_drvdata(pdev, mbox);
> -
> -	ret = mbox_controller_register(&mbox->controller);
> -	if (ret) {
> -		dev_err(dev, "Failed to register controller: %d\n", ret);
> -		goto err_disable_unprepare;
> -	}
> -
> -	return 0;
> -
> -err_disable_unprepare:
> -	clk_disable_unprepare(mbox->clk);
> -
> -	return ret;
> -}
> -
> -static void sun6i_msgbox_remove(struct platform_device *pdev)
> -{
> -	struct sun6i_msgbox *mbox = platform_get_drvdata(pdev);
>  
> -	mbox_controller_unregister(&mbox->controller);
> -	/* See the comment in sun6i_msgbox_probe about the reset line. */
> -	clk_disable_unprepare(mbox->clk);
> +	return devm_mbox_controller_register(&mbox->controller);

[Severity: Low]
Will this compile successfully?

Looking at the function signature in drivers/mailbox/mailbox.c,
devm_mbox_controller_register() requires two arguments:

int devm_mbox_controller_register(struct device *dev,
                                  struct mbox_controller *mbox)

The call here only provides the mbox_controller pointer and is missing the
struct device pointer as the first argument, which is likely to result in
a build failure.

>  }
>  
>  static const struct of_device_id sun6i_msgbox_of_match[] = {

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1