Hi On Wed, Feb 10, 2016 at 9:51 PM, Haixia Shi <hshi at chromium.org> wrote: >> This should rather be: >> >> drm_release(inode, filp); >> mutex_lock(&drm_global_mutex); >> if (!dev->open_count && udl_device_is_unplugged(dev)) >> drm_put_dev(dev); >> mutex_unlock(&drm_global_mutex); >> >> return 0; >> >> There is no reason to look at the return code of drm_release(), ever. > > But drm_release() does return a retcode. It would still make sense to return > that as-is in case any existing code relies on it.
Nobody should ever return error codes from fops.release(). It is completely bogus. You rather confuse generic user-space that calls close(), than getting any benefit out of it. But TBH, I don't care. Feel free to forward the return value. But still, please change the order of the calls as I did. Thanks David