[PATCH] drm/cirrus: fix leaky driver load error handling

2014-12-01 Thread Sean Paul
On Mon, Nov 17, 2014 at 5:19 PM, Zach Reizner  wrote:
> Before this patch, cirrus_device_init could have failed while
> cirrus_mm_init succeeded and the driver would have reported overall
> success on load. This patch causes cirrus_device_init to return on
> the first error encountered.
>
> Reviewed-by: Stéphane Marchesin 


The code itself looks good, just a few nits with the commit message.

I think you mean to s/cirrus_mm_init/cirrus_modeset_init/ and
s/cirrus_device_init/cirrus_mm_init/. You should also have a
Signed-off-by line (see section 12 of [1])

Sean

[1]- https://www.kernel.org/doc/Documentation/SubmittingPatches



> ---
>  drivers/gpu/drm/cirrus/cirrus_main.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c 
> b/drivers/gpu/drm/cirrus/cirrus_main.c
> index 99c1983..ab7cb54 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_main.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_main.c
> @@ -179,17 +179,22 @@ int cirrus_driver_load(struct drm_device *dev, unsigned 
> long flags)
> }
>
> r = cirrus_mm_init(cdev);
> -   if (r)
> +   if (r) {
> dev_err(>pdev->dev, "fatal err on mm init\n");
> +   goto out;
> +   }
>
> r = cirrus_modeset_init(cdev);
> -   if (r)
> +   if (r) {
> dev_err(>pdev->dev, "Fatal error during modeset init: 
> %d\n", r);
> +   goto out;
> +   }
>
> dev->mode_config.funcs = (void *)_mode_funcs;
> +
> +   return 0;
>  out:
> -   if (r)
> -   cirrus_driver_unload(dev);
> +   cirrus_driver_unload(dev);
> return r;
>  }
>
> --
> 2.1.0.rc2.206.gedb03e5
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/cirrus: fix leaky driver load error handling

2014-11-17 Thread Zach Reizner
Before this patch, cirrus_device_init could have failed while
cirrus_mm_init succeeded and the driver would have reported overall
success on load. This patch causes cirrus_device_init to return on
the first error encountered.

Reviewed-by: Stéphane Marchesin 
---
 drivers/gpu/drm/cirrus/cirrus_main.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c 
b/drivers/gpu/drm/cirrus/cirrus_main.c
index 99c1983..ab7cb54 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -179,17 +179,22 @@ int cirrus_driver_load(struct drm_device *dev, unsigned 
long flags)
}

r = cirrus_mm_init(cdev);
-   if (r)
+   if (r) {
dev_err(>pdev->dev, "fatal err on mm init\n");
+   goto out;
+   }

r = cirrus_modeset_init(cdev);
-   if (r)
+   if (r) {
dev_err(>pdev->dev, "Fatal error during modeset init: 
%d\n", r);
+   goto out;
+   }

dev->mode_config.funcs = (void *)_mode_funcs;
+
+   return 0;
 out:
-   if (r)
-   cirrus_driver_unload(dev);
+   cirrus_driver_unload(dev);
return r;
 }

-- 
2.1.0.rc2.206.gedb03e5