From: Zach Reizner Date: Tue, 18 Nov 2014 01:19:41 +0000 (-0800) Subject: drm/cirrus: fix leaky driver load error handling X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a7ca52e108e549669940b11779bb491a931f8c65;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/cirrus: fix leaky driver load error handling 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 Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c index 99c1983f99d2..ab7cb547c570 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(&dev->pdev->dev, "fatal err on mm init\n"); + goto out; + } r = cirrus_modeset_init(cdev); - if (r) + if (r) { dev_err(&dev->pdev->dev, "Fatal error during modeset init: %d\n", r); + goto out; + } dev->mode_config.funcs = (void *)&cirrus_mode_funcs; + + return 0; out: - if (r) - cirrus_driver_unload(dev); + cirrus_driver_unload(dev); return r; }