diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8c49fef1ce78..3d314338d843 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -1078,15 +1078,21 @@ static const struct drm_framebuffer_funcs radeon_fb_funcs = { | |||
1078 | .create_handle = radeon_user_framebuffer_create_handle, | 1078 | .create_handle = radeon_user_framebuffer_create_handle, |
1079 | }; | 1079 | }; |
1080 | 1080 | ||
1081 | void | 1081 | int |
1082 | radeon_framebuffer_init(struct drm_device *dev, | 1082 | radeon_framebuffer_init(struct drm_device *dev, |
1083 | struct radeon_framebuffer *rfb, | 1083 | struct radeon_framebuffer *rfb, |
1084 | struct drm_mode_fb_cmd2 *mode_cmd, | 1084 | struct drm_mode_fb_cmd2 *mode_cmd, |
1085 | struct drm_gem_object *obj) | 1085 | struct drm_gem_object *obj) |
1086 | { | 1086 | { |
1087 | int ret; | ||
1087 | rfb->obj = obj; | 1088 | rfb->obj = obj; |
1088 | drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs); | 1089 | ret = drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs); |
1090 | if (ret) { | ||
1091 | rfb->obj = NULL; | ||
1092 | return ret; | ||
1093 | } | ||
1089 | drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd); | 1094 | drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd); |
1095 | return 0; | ||
1090 | } | 1096 | } |
1091 | 1097 | ||
1092 | static struct drm_framebuffer * | 1098 | static struct drm_framebuffer * |
@@ -1096,6 +1102,7 @@ radeon_user_framebuffer_create(struct drm_device *dev, | |||
1096 | { | 1102 | { |
1097 | struct drm_gem_object *obj; | 1103 | struct drm_gem_object *obj; |
1098 | struct radeon_framebuffer *radeon_fb; | 1104 | struct radeon_framebuffer *radeon_fb; |
1105 | int ret; | ||
1099 | 1106 | ||
1100 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); | 1107 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); |
1101 | if (obj == NULL) { | 1108 | if (obj == NULL) { |
@@ -1108,7 +1115,12 @@ radeon_user_framebuffer_create(struct drm_device *dev, | |||
1108 | if (radeon_fb == NULL) | 1115 | if (radeon_fb == NULL) |
1109 | return ERR_PTR(-ENOMEM); | 1116 | return ERR_PTR(-ENOMEM); |
1110 | 1117 | ||
1111 | radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); | 1118 | ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); |
1119 | if (ret) { | ||
1120 | kfree(radeon_fb); | ||
1121 | drm_gem_object_unreference_unlocked(obj); | ||
1122 | return NULL; | ||
1123 | } | ||
1112 | 1124 | ||
1113 | return &radeon_fb->base; | 1125 | return &radeon_fb->base; |
1114 | } | 1126 | } |