On 24.11.22 10:35:32, Dan Williams wrote:

> diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c

> @@ -119,17 +131,22 @@ static int cxl_mem_probe(struct device *dev)
>               return -ENXIO;
>       }
>  
> -     device_lock(&parent_port->dev);
> -     if (!parent_port->dev.driver) {
> +     if (dport->rch)
> +             endpoint_parent = parent_port->uport;
> +     else
> +             endpoint_parent = &parent_port->dev;
> +
> +     device_lock(endpoint_parent);
> +     if (!endpoint_parent->driver) {
>               dev_err(dev, "CXL port topology %s not enabled\n",
>                       dev_name(&parent_port->dev));

This must be dev_name(endpoint_parent) here.

>               rc = -ENXIO;
>               goto unlock;
>       }
>  
> -     rc = devm_cxl_add_endpoint(cxlmd, dport);
> +     rc = devm_cxl_add_endpoint(endpoint_parent, cxlmd, dport);
>  unlock:
> -     device_unlock(&parent_port->dev);
> +     device_unlock(endpoint_parent);
>       put_device(&parent_port->dev);

This is correct and the counterpart to cxl_mem_find_port().

>       if (rc)
>               return rc;

-Robert

Reply via email to