drm:drm_stub: rewrite error handle code for drm_fill_in_dev
Subsystems (2)
PATCH 5/5 drm:drm_stub: rewrite error handle code for drm_fill_in_dev
Rewrite error handle code in a more rational and normal way, it bring us benefit that we could drop call to drm_lastclose which do "too much" cleanup work for drm_fill_in_dev.
Signed-off-by Wang YanQing <[email protected]>
--- drivers/gpu/drm/drm_stub.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_stub.c +21 -5
@@ -316,7 +316,7 @@ int drm_fill_in_dev(struct drm_device *dev,if (dev->driver->bus->agp_init) { retcode = dev->driver->bus->agp_init (dev);if (retcode) - goto error_out_unreg; + goto err_g1; }
@@ -324,7 +324,7 @@ int drm_fill_in_dev(struct drm_device *dev, retcode =drm_ctxbitmap_init (dev);if (retcode) {DRM_ERROR ("Cannot allocate memory for context bitmap.\n" ); - goto error_out_unreg; + goto err_g2; }if (driver->driver_features &DRIVER_GEM ) {
@@ -332,14 +332,30 @@ int drm_fill_in_dev(struct drm_device *dev,if (retcode) {DRM_ERROR ("Cannot initialize graphics execution " "manager (GEM)\n" ); - goto error_out_unreg; + goto err_g3; } }return 0 ; - error_out_unreg: -drm_lastclose (dev); +err_g3: +drm_ctxbitmap_cleanup (dev); +err_g2: +if (drm_core_has_MTRR (dev) &&drm_core_has_AGP (dev) && + dev->agp && dev->agp->agp_mtrr >=0 ) { +int retval; + retval =mtrr_del (dev->agp->agp_mtrr, + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size *1024 *1024 ); +DRM_DEBUG ("mtrr_del=%d\n" , retval); + } + +if (drm_core_has_AGP (dev) && dev->agp) { +kfree (dev->agp); + dev->agp =NULL ; + } +err_g1: +drm_ht_remove (&dev->map_hash);return retcode; }EXPORT_SYMBOL (drm_fill_in_dev);
Signature · 1 line
1.7.12.4.dirty