* [PATCH] drm: remove duplicate check on parent and avoid BUG_ON
@ 2019-12-15 19:43 ` Aditya Pakki
0 siblings, 0 replies; 4+ messages in thread
From: Aditya Pakki @ 2019-12-15 19:43 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
Daniel Vetter, dri-devel, linux-kernel
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>
---
drivers/gpu/drm/drm_drv.c | 5 +++--
1 file 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);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm: remove duplicate check on parent and avoid BUG_ON
@ 2019-12-15 19:43 ` Aditya Pakki
0 siblings, 0 replies; 4+ messages in thread
From: Aditya Pakki @ 2019-12-15 19:43 UTC (permalink / raw)
To: pakki001; +Cc: David Airlie, kjlu, linux-kernel, dri-devel, Sean Paul
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>
---
drivers/gpu/drm/drm_drv.c | 5 +++--
1 file 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);
--
2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: remove duplicate check on parent and avoid BUG_ON
2019-12-15 19:43 ` Aditya Pakki
@ 2019-12-17 13:13 ` Daniel Vetter
-1 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2019-12-17 13:13 UTC (permalink / raw)
To: Aditya Pakki
Cc: kjlu, Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
Daniel Vetter, dri-devel, linux-kernel
On Sun, Dec 15, 2019 at 01:43:44PM -0600, Aditya Pakki wrote:
> 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>
Makes sense, patch applied to drm-misc-next.
Thanks, Daniel
> ---
> drivers/gpu/drm/drm_drv.c | 5 +++--
> 1 file 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);
> --
> 2.20.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: remove duplicate check on parent and avoid BUG_ON
@ 2019-12-17 13:13 ` Daniel Vetter
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2019-12-17 13:13 UTC (permalink / raw)
To: Aditya Pakki; +Cc: David Airlie, kjlu, linux-kernel, dri-devel, Sean Paul
On Sun, Dec 15, 2019 at 01:43:44PM -0600, Aditya Pakki wrote:
> 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>
Makes sense, patch applied to drm-misc-next.
Thanks, Daniel
> ---
> drivers/gpu/drm/drm_drv.c | 5 +++--
> 1 file 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);
> --
> 2.20.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-17 13:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 19:43 [PATCH] drm: remove duplicate check on parent and avoid BUG_ON Aditya Pakki
2019-12-15 19:43 ` Aditya Pakki
2019-12-17 13:13 ` Daniel Vetter
2019-12-17 13:13 ` Daniel Vetter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.