[Intel-gfx] [PATCH 06/15] mei: pxp: support matching with a gfx discrete card

Teres Alexis, Alan Previn alan.previn.teres.alexis at intel.com
Wed Jul 27 01:01:09 UTC 2022


On Thu, 2022-06-09 at 16:19 -0700, Ceraolo Spurio, Daniele wrote:
> From: Tomas Winkler <tomas.winkler at intel.com>
> 
> Support matching with a discrete graphics card.
> 
> Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
> Cc: Vitaly Lubart <vitaly.lubart at intel.com>
> ---
>  drivers/misc/mei/pxp/mei_pxp.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c
> index 94d3ef3cc73a..645862f4bb38 100644
> --- a/drivers/misc/mei/pxp/mei_pxp.c
> +++ b/drivers/misc/mei/pxp/mei_pxp.c
> @@ -162,13 +162,20 @@ static int mei_pxp_component_match(struct device *dev, int subcomponent,
>  	    subcomponent != I915_COMPONENT_PXP)
>  		return 0;
>  
> -	base = base->parent;
> -	if (!base)
> +	if (!dev)
>  		return 0;
> 
This check for !dev seems to be appearing a few lines after this other check below, which looks like a bug coz it means
dev can be null and we are checking for validity after dereferencing it:
	if (!dev->driver || strcmp(dev->driver->name, "i915") ||
	    subcomponent != I915_COMPONENT_PXP)
		return 0;

Im assuming this is an unintentional oversight so conditional RB to move things on (please fix when merging):

Reviewed-by: Alan Previn <alan.previn.teres.alexis at intel.com>

>  
>  	base = base->parent;
> -	dev = dev->parent;
> +	if (!base) /* mei device */
> +		return 0;
>  
> +	base = base->parent; /* pci device */
> +	/* for dgfx */
> +	if (base && dev == base)
> +		return 1;
> +
> +	/* for pch */
> +	dev = dev->parent;
>  	return (base && dev && dev == base);
>  }
>  
> -- 
> 2.25.1
> 



More information about the Intel-gfx mailing list