Re: [PATCH 6/8] drm/i915: Demidlayer driver loading

Chris Wilson
2016-06-21T13:32:17Z

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