2020-11-30 02:09:03

by Jialin Zhang

[permalink] [raw]
Subject: [PATCH] drm/gma500: Fix error return code in psb_driver_load()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jialin Zhang <[email protected]>
---
drivers/gpu/drm/gma500/psb_drv.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 34b4aae9a15e..074f403d7ca0 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -313,6 +313,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
if (ret)
goto out_err;

+ ret = -ENOMEM;
+
dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, 0);
if (!dev_priv->mmu)
goto out_err;
--
2.25.1


2020-11-30 14:35:39

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH] drm/gma500: Fix error return code in psb_driver_load()

On Mon, Nov 30, 2020 at 10:02:16AM +0800, Jialin Zhang wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Jialin Zhang <[email protected]>

Out of curiosity, what is hulk robot matching here? This is a really
interesting bug for automated checkers to find!

Thanks for the patch, applied to drm-misc-next.
-Daniel

> ---
> drivers/gpu/drm/gma500/psb_drv.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
> index 34b4aae9a15e..074f403d7ca0 100644
> --- a/drivers/gpu/drm/gma500/psb_drv.c
> +++ b/drivers/gpu/drm/gma500/psb_drv.c
> @@ -313,6 +313,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
> if (ret)
> goto out_err;
>
> + ret = -ENOMEM;
> +
> dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, 0);
> if (!dev_priv->mmu)
> goto out_err;
> --
> 2.25.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch