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
This commit is contained in:
@ -326,8 +326,8 @@ static int hdlcd_drm_bind(struct device *dev)
|
||||
return -ENOMEM;
|
||||
|
||||
drm = drm_dev_alloc(&hdlcd_driver, dev);
|
||||
if (!drm)
|
||||
return -ENOMEM;
|
||||
if (IS_ERR(drm))
|
||||
return PTR_ERR(drm);
|
||||
|
||||
drm->dev_private = hdlcd;
|
||||
dev_set_drvdata(dev, drm);
|
||||
|
@ -311,8 +311,8 @@ static int malidp_bind(struct device *dev)
|
||||
return ret;
|
||||
|
||||
drm = drm_dev_alloc(&malidp_driver, dev);
|
||||
if (!drm) {
|
||||
ret = -ENOMEM;
|
||||
if (IS_ERR(drm)) {
|
||||
ret = PTR_ERR(drm);
|
||||
goto alloc_fail;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user