Re: [PATCH v5 08/12] cxl: Set cxlmd->endpoint before adding port device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 6 Feb 2024 15:28:36 -0700
Dave Jiang <dave.jiang@xxxxxxxxx> wrote:

> Move setting of cxlmd->endpoint to before calling add_device() on the port
> device. Otherwise when referencing cxlmd->endpoint in region discovery code
> that is triggered by the port driver probe function, the endpoint port
> pointer is not valid.

Maybe make it clear this only matters (I assume) when we start doing
such a look up?  Otherwise description sounds like a fix.


> 
> Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
Change looks fine

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxx>

> ---
>  drivers/cxl/core/port.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index e8029170b8c6..2f2b7af9275e 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -822,6 +822,7 @@ static struct cxl_port *__devm_cxl_add_port(struct device *host,
>  		 */
>  		port->reg_map = cxlds->reg_map;
>  		port->reg_map.host = &port->dev;
> +		cxlmd->endpoint = port;
>  	} else if (parent_dport) {
>  		rc = dev_set_name(dev, "port%d", port->id);
>  		if (rc)
> @@ -1374,7 +1375,6 @@ int cxl_endpoint_autoremove(struct cxl_memdev *cxlmd, struct cxl_port *endpoint)
>  
>  	get_device(host);
>  	get_device(&endpoint->dev);
> -	cxlmd->endpoint = endpoint;
>  	cxlmd->depth = endpoint->depth;
>  	return devm_add_action_or_reset(dev, delete_endpoint, cxlmd);
>  }





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux