diff options
author | Tom Gundersen <teg@jklm.no> | 2016-09-21 16:59:19 +0200 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2016-09-22 04:03:48 -0700 |
commit | 0f2886057be322ddfa4858384c40a505f7a32a4a (patch) | |
tree | 95fd93e32cce031f99920cd1937b4e46491e65b3 /drivers/gpu/drm/drm_drv.c | |
parent | c6bf811a0b55ab224fb2c75345641b4bb599475c (diff) | |
download | blackbird-op-linux-0f2886057be322ddfa4858384c40a505f7a32a4a.tar.gz blackbird-op-linux-0f2886057be322ddfa4858384c40a505f7a32a4a.zip |
drm: Don't swallow error codes in drm_dev_alloc()
There are many reasons other than ENOMEM that drm_dev_init() can
fail. Return ERR_PTR rather than NULL to be able to distinguish
these in the caller.
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20160921145919.13754-2-teg@jklm.no
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 99e67517b5c5..80c7f25b5b74 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -591,7 +591,7 @@ EXPORT_SYMBOL(drm_dev_init); * own struct should look at using drm_dev_init() instead. * * RETURNS: - * Pointer to new DRM device, or NULL if out of memory. + * Pointer to new DRM device, or ERR_PTR on failure. */ struct drm_device *drm_dev_alloc(struct drm_driver *driver, struct device *parent) @@ -601,12 +601,12 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) - return NULL; + return ERR_PTR(-ENOMEM); ret = drm_dev_init(dev, driver, parent); if (ret) { kfree(dev); - return NULL; + return ERR_PTR(ret); } return dev; |