Re: [PATCH] dax: fix dax_core_init error return code

From: Jonathan Cameron

Date: Mon Oct 12 2026 - 10:35:50 EST


On Sun, 11 Oct 2026 21:20:17 +0800
jianyungao89@xxxxxxxxx wrote:

> From: Jianyun Gao <jianyungao89@xxxxxxxxx>
>
> dax_core_init() mistakenly returns 0 on error paths. Change the
> error return to use rc so the actual error code is propagated
> to the caller.

What is the user visible impact of this failing?

>
> Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
> Signed-off-by: Jianyun Gao <jianyungao89@xxxxxxxxx>
> ---
> drivers/dax/super.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 45f84b0eb909..0f35f65363ee 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -723,7 +723,7 @@ static int __init dax_core_init(void)
>
> rc = dax_fs_init();
> if (rc)
> - return rc;
> + goto err_fs;
I don't see an advantage in this bit. It is a fairly common preference
to error out directly where there is nothing to do.

>
> rc = alloc_chrdev_region(&dax_devt, 0, MINORMASK+1, "dax");
> if (rc)
> @@ -738,7 +738,8 @@ static int __init dax_core_init(void)
> unregister_chrdev_region(dax_devt, MINORMASK+1);
> err_chrdev:
> dax_fs_exit();
> - return 0;
> +err_fs:
> + return rc;
I'm not sure about this one. Will need input from the DAX
folk on whether they were deliberately eating the error return
here. Not that I can immediately think of a reason to do so!

Jonathan


> }
>
> static void __exit dax_core_exit(void)