[Intel-gfx] [PATCH 21/37] drm: Propagate failure from drm_setup_crtcs()
Chris Wilson
chris at chris-wilson.co.uk
Wed Mar 10 23:45:08 CET 2010
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Dave Airlie <airlied at redhat.com>
---
drivers/gpu/drm/drm_crtc_helper.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index b3f369f..6b2cd91 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -494,7 +494,7 @@ out:
return best_score;
}
-static void drm_setup_crtcs(struct drm_device *dev)
+static int drm_setup_crtcs(struct drm_device *dev)
{
struct drm_crtc **crtcs;
struct drm_display_mode **modes;
@@ -520,6 +520,12 @@ static void drm_setup_crtcs(struct drm_device *dev)
sizeof(struct drm_display_mode *), GFP_KERNEL);
enabled = kcalloc(dev->mode_config.num_connector,
sizeof(bool), GFP_KERNEL);
+ if (crtcs == NULL || modes == NULL || enabled == NULL) {
+ kfree(crtcs);
+ kfree(modes);
+ kfree(enabled);
+ return -ENOMEM;
+ }
drm_enable_connectors(dev, enabled);
@@ -556,6 +562,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
kfree(crtcs);
kfree(modes);
kfree(enabled);
+
+ return 0;
}
/**
@@ -1018,6 +1026,7 @@ bool drm_helper_plugged_event(struct drm_device *dev)
bool drm_helper_initial_config(struct drm_device *dev)
{
int count = 0;
+ int ret;
/* disable all the possible outputs/crtcs before entering KMS mode */
drm_helper_disable_unused_functions(dev);
@@ -1034,7 +1043,9 @@ bool drm_helper_initial_config(struct drm_device *dev)
if (count == 0)
printk(KERN_INFO "No connectors reported connected with modes\n");
- drm_setup_crtcs(dev);
+ ret = drm_setup_crtcs(dev);
+ if (ret)
+ return ret;
/* alert the driver fb layer */
dev->mode_config.funcs->fb_changed(dev);
--
1.7.0
More information about the Intel-gfx
mailing list