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

Greg Kroah-Hartman gregkh at linuxfoundation.org
Mon Sep 12 14:25:29 UTC 2022


On Mon, Sep 12, 2022 at 09:59:45AM +0000, Winkler, Tomas wrote:
> > 
> > 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.
> 
> I'm not sure, this is the case here.  The function is passed to  i915 (other driver) driver via struct i915_pxp_component_op.
> This is outside of the component framework. 

Then pass in the real mei structure please.  Don't force someone else to
"find" it in the device tree like you are currently trying to do.

thanks,

greg k-h


More information about the dri-devel mailing list