Re: [PATCH] dax: fix mapping_store() returning 0 instead of error code

From: Jonathan Cameron

Date: Mon Oct 12 2026 - 10:57:15 EST


On Sun, 11 Oct 2026 21:18:57 +0800
jianyungao89@xxxxxxxxx wrote:

> From: Jianyun Gao <jianyungao89@xxxxxxxxx>
>
> When the region driver is not loaded, mapping_store() returns rc
> which is 0 at that point, instead of an error code. Set it to
> -ENXIO to match the equivalent check in size_store().
>
> Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
> Signed-off-by: Jianyun Gao <jianyungao89@xxxxxxxxx>

Looks correct to me.
Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>

I'm curious, found by inspection or some tool?

J

> ---
> drivers/dax/bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index b809e1a264af..262f97b5e7aa 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -1192,7 +1192,7 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
> return rc;
> if (!dax_region->dev->driver) {
> up_write(&dax_region_rwsem);
> - return rc;
> + return -ENXIO;
> }
> rc = down_write_killable(&dax_dev_rwsem);
> if (rc) {