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

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

 



On Thu, 2022-06-09 at 16:19 -0700, Ceraolo Spurio, Daniele wrote:
> From: Tomas Winkler <tomas.winkler@xxxxxxxxx>
> 
> Support matching with a discrete graphics card.
> 
> Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
> Cc: Vitaly Lubart <vitaly.lubart@xxxxxxxxx>
> ---
>  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@xxxxxxxxx>

>  
>  	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
> 





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux