diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index afd9035..2ffec4a 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -535,6 +535,7 @@ static int drm_load(drm_device_t *dev) if (dev->driver.load != NULL) { DRM_LOCK(); + /* shared code returns -errno */ retcode = -dev->driver.load(dev, dev->id_entry->driver_private); DRM_UNLOCK(); @@ -717,6 +718,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) return EINVAL; } +if (--file_priv->refs == 0) { + if (dev->driver.preclose != NULL) dev->driver.preclose(dev, file_priv); @@ -792,7 +795,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) dev->buf_pgid = 0; #endif /* __NetBSD__ || __OpenBSD__ */ - if (--file_priv->refs == 0) { +// if (--file_priv->refs == 0) { if (dev->driver.postclose != NULL) dev->driver.postclose(dev, file_priv); TAILQ_REMOVE(&dev->files, file_priv, link);