diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-06-06 05:50:03 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-06-07 19:32:02 -0400 |
commit | 5a79395b2791cc70442ab8434aed1b5206683e7c (patch) | |
tree | e730abdc96aa8de4697b14c8ff995b27fec74409 /drivers/gpu | |
parent | a3524f1b27671eda909cde37da9caff41133b272 (diff) |
drm: Propagate error from drm_fb_helper_init().
The previous commit fixes the problem, these commits make sure we actually
fail properly if it happens again.
I've squashed the commits from Chris since they are all fixing one issue.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_fb.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fbcon.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_fb.c | 12 |
4 files changed, 38 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index b2ebf02e4f8a..59a2bf8592ec 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1402,19 +1402,19 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1402 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ | 1402 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ |
1403 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); | 1403 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); |
1404 | if (ret) | 1404 | if (ret) |
1405 | goto destroy_ringbuffer; | 1405 | goto cleanup_ringbuffer; |
1406 | 1406 | ||
1407 | ret = vga_switcheroo_register_client(dev->pdev, | 1407 | ret = vga_switcheroo_register_client(dev->pdev, |
1408 | i915_switcheroo_set_state, | 1408 | i915_switcheroo_set_state, |
1409 | i915_switcheroo_can_switch); | 1409 | i915_switcheroo_can_switch); |
1410 | if (ret) | 1410 | if (ret) |
1411 | goto destroy_ringbuffer; | 1411 | goto cleanup_vga_client; |
1412 | 1412 | ||
1413 | intel_modeset_init(dev); | 1413 | intel_modeset_init(dev); |
1414 | 1414 | ||
1415 | ret = drm_irq_install(dev); | 1415 | ret = drm_irq_install(dev); |
1416 | if (ret) | 1416 | if (ret) |
1417 | goto destroy_ringbuffer; | 1417 | goto cleanup_vga_switcheroo; |
1418 | 1418 | ||
1419 | /* Always safe in the mode setting case. */ | 1419 | /* Always safe in the mode setting case. */ |
1420 | /* FIXME: do pre/post-mode set stuff in core KMS code */ | 1420 | /* FIXME: do pre/post-mode set stuff in core KMS code */ |
@@ -1426,11 +1426,20 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1426 | 1426 | ||
1427 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); | 1427 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); |
1428 | 1428 | ||
1429 | intel_fbdev_init(dev); | 1429 | ret = intel_fbdev_init(dev); |
1430 | if (ret) | ||
1431 | goto cleanup_irq; | ||
1432 | |||
1430 | drm_kms_helper_poll_init(dev); | 1433 | drm_kms_helper_poll_init(dev); |
1431 | return 0; | 1434 | return 0; |
1432 | 1435 | ||
1433 | destroy_ringbuffer: | 1436 | cleanup_irq: |
1437 | drm_irq_uninstall(dev); | ||
1438 | cleanup_vga_switcheroo: | ||
1439 | vga_switcheroo_unregister_client(dev->pdev); | ||
1440 | cleanup_vga_client: | ||
1441 | vga_client_register(dev->pdev, NULL, NULL, NULL); | ||
1442 | cleanup_ringbuffer: | ||
1434 | mutex_lock(&dev->struct_mutex); | 1443 | mutex_lock(&dev->struct_mutex); |
1435 | i915_gem_cleanup_ringbuffer(dev); | 1444 | i915_gem_cleanup_ringbuffer(dev); |
1436 | mutex_unlock(&dev->struct_mutex); | 1445 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index dfbb0c6e1f51..c3c505244e07 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -245,6 +245,7 @@ int intel_fbdev_init(struct drm_device *dev) | |||
245 | { | 245 | { |
246 | struct intel_fbdev *ifbdev; | 246 | struct intel_fbdev *ifbdev; |
247 | drm_i915_private_t *dev_priv = dev->dev_private; | 247 | drm_i915_private_t *dev_priv = dev->dev_private; |
248 | int ret; | ||
248 | 249 | ||
249 | ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); | 250 | ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); |
250 | if (!ifbdev) | 251 | if (!ifbdev) |
@@ -253,8 +254,13 @@ int intel_fbdev_init(struct drm_device *dev) | |||
253 | dev_priv->fbdev = ifbdev; | 254 | dev_priv->fbdev = ifbdev; |
254 | ifbdev->helper.funcs = &intel_fb_helper_funcs; | 255 | ifbdev->helper.funcs = &intel_fb_helper_funcs; |
255 | 256 | ||
256 | drm_fb_helper_init(dev, &ifbdev->helper, dev_priv->num_pipe, | 257 | ret = drm_fb_helper_init(dev, &ifbdev->helper, |
257 | INTELFB_CONN_LIMIT); | 258 | dev_priv->num_pipe, |
259 | INTELFB_CONN_LIMIT); | ||
260 | if (ret) { | ||
261 | kfree(ifbdev); | ||
262 | return ret; | ||
263 | } | ||
258 | 264 | ||
259 | drm_fb_helper_single_add_all_connectors(&ifbdev->helper); | 265 | drm_fb_helper_single_add_all_connectors(&ifbdev->helper); |
260 | drm_fb_helper_initial_config(&ifbdev->helper, 32); | 266 | drm_fb_helper_initial_config(&ifbdev->helper, 32); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index fd4a2df715e9..c9a4a0d2a115 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -377,6 +377,7 @@ int nouveau_fbcon_init(struct drm_device *dev) | |||
377 | { | 377 | { |
378 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 378 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
379 | struct nouveau_fbdev *nfbdev; | 379 | struct nouveau_fbdev *nfbdev; |
380 | int ret; | ||
380 | 381 | ||
381 | nfbdev = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL); | 382 | nfbdev = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL); |
382 | if (!nfbdev) | 383 | if (!nfbdev) |
@@ -386,7 +387,12 @@ int nouveau_fbcon_init(struct drm_device *dev) | |||
386 | dev_priv->nfbdev = nfbdev; | 387 | dev_priv->nfbdev = nfbdev; |
387 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; | 388 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; |
388 | 389 | ||
389 | drm_fb_helper_init(dev, &nfbdev->helper, 2, 4); | 390 | ret = drm_fb_helper_init(dev, &nfbdev->helper, 2, 4); |
391 | if (ret) { | ||
392 | kfree(nfbdev); | ||
393 | return ret; | ||
394 | } | ||
395 | |||
390 | drm_fb_helper_single_add_all_connectors(&nfbdev->helper); | 396 | drm_fb_helper_single_add_all_connectors(&nfbdev->helper); |
391 | drm_fb_helper_initial_config(&nfbdev->helper, 32); | 397 | drm_fb_helper_initial_config(&nfbdev->helper, 32); |
392 | return 0; | 398 | return 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index e192acfbf0cd..dc1634bb0c11 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -363,6 +363,7 @@ int radeon_fbdev_init(struct radeon_device *rdev) | |||
363 | { | 363 | { |
364 | struct radeon_fbdev *rfbdev; | 364 | struct radeon_fbdev *rfbdev; |
365 | int bpp_sel = 32; | 365 | int bpp_sel = 32; |
366 | int ret; | ||
366 | 367 | ||
367 | /* select 8 bpp console on RN50 or 16MB cards */ | 368 | /* select 8 bpp console on RN50 or 16MB cards */ |
368 | if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) | 369 | if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) |
@@ -376,9 +377,14 @@ int radeon_fbdev_init(struct radeon_device *rdev) | |||
376 | rdev->mode_info.rfbdev = rfbdev; | 377 | rdev->mode_info.rfbdev = rfbdev; |
377 | rfbdev->helper.funcs = &radeon_fb_helper_funcs; | 378 | rfbdev->helper.funcs = &radeon_fb_helper_funcs; |
378 | 379 | ||
379 | drm_fb_helper_init(rdev->ddev, &rfbdev->helper, | 380 | ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper, |
380 | rdev->num_crtc, | 381 | rdev->num_crtc, |
381 | RADEONFB_CONN_LIMIT); | 382 | RADEONFB_CONN_LIMIT); |
383 | if (ret) { | ||
384 | kfree(rfbdev); | ||
385 | return ret; | ||
386 | } | ||
387 | |||
382 | drm_fb_helper_single_add_all_connectors(&rfbdev->helper); | 388 | drm_fb_helper_single_add_all_connectors(&rfbdev->helper); |
383 | drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); | 389 | drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); |
384 | return 0; | 390 | return 0; |