aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_fb.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-03-26 13:51:57 -0400
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-12-19 04:24:54 -0500
commita39c94e8138f4708b92245a7021ad4d40376360f (patch)
treef427d0cdace887685e13460c10ba0b5ad8c1735b /drivers/gpu/drm/omapdrm/omap_fb.c
parentc9028b39597fbdcdac96641e12cc656a27c137c1 (diff)
drm: omapdrm: fb: Simplify objects lookup when creating framebuffer
Merge the single-user objects_lookup inline function into its caller, allowing reuse of the error code path. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_fb.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 6315d68989fc..195ab4c86244 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -354,22 +354,29 @@ void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)
354struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, 354struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,
355 struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd) 355 struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd)
356{ 356{
357 unsigned int num_planes = drm_format_num_planes(mode_cmd->pixel_format);
357 struct drm_gem_object *bos[4]; 358 struct drm_gem_object *bos[4];
358 struct drm_framebuffer *fb; 359 struct drm_framebuffer *fb;
359 int ret; 360 int i;
360 361
361 ret = objects_lookup(file, mode_cmd->pixel_format, 362 for (i = 0; i < num_planes; i++) {
362 bos, mode_cmd->handles); 363 bos[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
363 if (ret) 364 if (!bos[i]) {
364 return ERR_PTR(ret); 365 fb = ERR_PTR(-ENOENT);
366 goto error;
367 }
368 }
365 369
366 fb = omap_framebuffer_init(dev, mode_cmd, bos); 370 fb = omap_framebuffer_init(dev, mode_cmd, bos);
367 if (IS_ERR(fb)) { 371 if (IS_ERR(fb))
368 int i, n = drm_format_num_planes(mode_cmd->pixel_format); 372 goto error;
369 for (i = 0; i < n; i++) 373
370 drm_gem_object_unreference_unlocked(bos[i]); 374 return fb;
371 return fb; 375
372 } 376error:
377 while (--i > 0)
378 drm_gem_object_unreference_unlocked(bos[i]);
379
373 return fb; 380 return fb;
374} 381}
375 382