[PATCH v4 05/15] mei: pxp: add command streamer API to the PXP driver

Greg Kroah-Hartman gregkh at linuxfoundation.org
Fri Sep 9 06:42:08 UTC 2022


On Fri, Sep 09, 2022 at 06:38:33AM +0000, Winkler, Tomas wrote:
> > 
> > On Thu, Sep 08, 2022 at 05:16:02PM -0700, Daniele Ceraolo Spurio wrote:
> > > +static ssize_t mei_pxp_gsc_command(struct device *dev, u8 client_id,
> > u32 fence_id,
> > > +				   struct scatterlist *sg_in, size_t total_in_len,
> > > +				   struct scatterlist *sg_out)
> > > +{
> > > +	struct mei_cl_device *cldev;
> > > +
> > > +	if (!dev || !sg_in || !sg_out)
> > > +		return -EINVAL;
> > 
> > How can these ever be NULL?  Doesn't the core control this, so why would
> > that happen?
> This is any interface function between modules, I think it is not healthy to take assumptions here about how caller
> behaves, this is not an inner functions. This is important even for catching programmatical mistakes. 

It is a static function being called from a framework.  Enforce this in
the framework, don't sprinkle this stuff everywhere, the kernel is NOT
defensive about internal users like this otherwise it will overwhelm
every function call.

thanks,

greg k-h


More information about the dri-devel mailing list