Skip to content

Commit

Permalink
drm/cirrus: fix leaky driver load error handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zach Reizner authored and Dave Airlie committed Nov 20, 2014
1 parent b0fcfc8 commit a7ca52e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/gpu/drm/cirrus/cirrus_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a7ca52e

Please sign in to comment.