[Intel-gfx] [PATCH 6/8] drm/i915: Demidlayer driver loading

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 21 13:32:11 UTC 2016


On Tue, Jun 21, 2016 at 03:27:02PM +0200, Daniel Vetter wrote:
> On Tue, Jun 21, 2016 at 09:53:46AM +0100, Chris Wilson wrote:
> > -int i915_driver_load(struct drm_device *dev, unsigned long flags)
> > +int i915_driver_load(struct pci_dev *pdev,
> > +		     const struct pci_device_id *ent,
> > +		     struct drm_driver *driver)
> >  {
> >  	struct drm_i915_private *dev_priv;
> > -	int ret = 0;
> > +	int ret;
> >  
> > +	ret = 0;
> >  	dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
> > -	if (dev_priv == NULL)
> > +	if (dev_priv)
> > +		ret = drm_dev_init(&dev_priv->drm, driver, &pdev->dev);
> > +	if (ret) {
> 
> This ended up a bit too clever, will fail to spot the failure when
> dev_priv == NULL. I guess you wanted a ret = -ENOMEM up there.

Yup, and we should then return ret rather than return -ENOMEM.
Ta,
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list