summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_drv.c
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-12-15 22:43:44 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-12-17 19:26:08 +0300
commit8b6fc114beeb9f1a270e5b6d25c30a5143801bf8 (patch)
treea77e1a24914f58ad7893da22143e8f4846d88168 /drivers/gpu/drm/drm_drv.c
parent4f865a74c8f8a694eb9f6b6fdb8f5d8f475c8875 (diff)
downloadlinux-8b6fc114beeb9f1a270e5b6d25c30a5143801bf8.tar.xz
drm: remove duplicate check on parent and avoid BUG_ON
In drm_dev_init, parent is checked for NULL via assert after checked in devm_drm_dev_init(). The patch removes the duplicate check and replaces the assertion with WARN_ON. Further, it returns -EINVAL consistent with the usage in devm_drm_dev_init. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20191215194345.4679-1-pakki001@umn.edu
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r--drivers/gpu/drm/drm_drv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 1b9b40a1c7c9..7c18a980cd4b 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -622,7 +622,8 @@ int drm_dev_init(struct drm_device *dev,
return -ENODEV;
}
- BUG_ON(!parent);
+ if (WARN_ON(!parent))
+ return -EINVAL;
kref_init(&dev->ref);
dev->dev = get_device(parent);
@@ -725,7 +726,7 @@ int devm_drm_dev_init(struct device *parent,
{
int ret;
- if (WARN_ON(!parent || !driver->release))
+ if (WARN_ON(!driver->release))
return -EINVAL;
ret = drm_dev_init(dev, driver, parent);