Re: [PATCH v8 1/9] dax/bus: Use dax_region_put() in alloc_dax_region() error path

From: Dan Williams

Date: Mon Mar 23 2026 - 15:37:56 EST


Smita Koralahalli wrote:
> alloc_dax_region() calls kref_init() on the dax_region early in the
> function, but the error path for sysfs_create_groups() failure uses
> kfree() directly to free the dax_region. This bypasses the kref lifecycle.
>
> Use dax_region_put() instead to handle kref lifecycle correctly.

There is no correctness issue here, the object was never published.

I am ok with the change, but be clear that this is for pure symmetry
reasons, not correctness.

Reviewed-by: Dan Williams <dan.j.williams@xxxxxxxxx>