diff options
author | Zach Reizner <zachr@google.com> | 2014-11-17 20:19:41 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-11-19 20:41:26 -0500 |
commit | a7ca52e108e549669940b11779bb491a931f8c65 (patch) | |
tree | 290248f5e52ba80d17e82b0bf22103e79b041ea6 | |
parent | b0fcfc899513a4d4729914b6872ab0564c0f523a (diff) |
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 <marcheu@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_main.c | 13 |
1 files changed, 9 insertions, 4 deletions
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) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | r = cirrus_mm_init(cdev); | 181 | r = cirrus_mm_init(cdev); |
182 | if (r) | 182 | if (r) { |
183 | dev_err(&dev->pdev->dev, "fatal err on mm init\n"); | 183 | dev_err(&dev->pdev->dev, "fatal err on mm init\n"); |
184 | goto out; | ||
185 | } | ||
184 | 186 | ||
185 | r = cirrus_modeset_init(cdev); | 187 | r = cirrus_modeset_init(cdev); |
186 | if (r) | 188 | if (r) { |
187 | dev_err(&dev->pdev->dev, "Fatal error during modeset init: %d\n", r); | 189 | dev_err(&dev->pdev->dev, "Fatal error during modeset init: %d\n", r); |
190 | goto out; | ||
191 | } | ||
188 | 192 | ||
189 | dev->mode_config.funcs = (void *)&cirrus_mode_funcs; | 193 | dev->mode_config.funcs = (void *)&cirrus_mode_funcs; |
194 | |||
195 | return 0; | ||
190 | out: | 196 | out: |
191 | if (r) | 197 | cirrus_driver_unload(dev); |
192 | cirrus_driver_unload(dev); | ||
193 | return r; | 198 | return r; |
194 | } | 199 | } |
195 | 200 | ||