@@ -415,7 +415,7 @@ void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem,
415415}
416416EXPORT_SYMBOL (drm_gem_shmem_vunmap );
417417
418- static struct drm_gem_shmem_object *
418+ static int
419419drm_gem_shmem_create_with_handle (struct drm_file * file_priv ,
420420 struct drm_device * dev , size_t size ,
421421 uint32_t * handle )
@@ -425,7 +425,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,
425425
426426 shmem = drm_gem_shmem_create (dev , size );
427427 if (IS_ERR (shmem ))
428- return shmem ;
428+ return PTR_ERR ( shmem ) ;
429429
430430 /*
431431 * Allocate an id of idr table where the obj is registered
@@ -434,10 +434,8 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,
434434 ret = drm_gem_handle_create (file_priv , & shmem -> base , handle );
435435 /* drop reference from allocate - handle holds it now. */
436436 drm_gem_object_put (& shmem -> base );
437- if (ret )
438- return ERR_PTR (ret );
439437
440- return shmem ;
438+ return ret ;
441439}
442440
443441/* Update madvise status, returns true if not purged, else
@@ -520,7 +518,6 @@ int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *dev,
520518 struct drm_mode_create_dumb * args )
521519{
522520 u32 min_pitch = DIV_ROUND_UP (args -> width * args -> bpp , 8 );
523- struct drm_gem_shmem_object * shmem ;
524521
525522 if (!args -> pitch || !args -> size ) {
526523 args -> pitch = min_pitch ;
@@ -533,9 +530,7 @@ int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *dev,
533530 args -> size = PAGE_ALIGN (args -> pitch * args -> height );
534531 }
535532
536- shmem = drm_gem_shmem_create_with_handle (file , dev , args -> size , & args -> handle );
537-
538- return PTR_ERR_OR_ZERO (shmem );
533+ return drm_gem_shmem_create_with_handle (file , dev , args -> size , & args -> handle );
539534}
540535EXPORT_SYMBOL_GPL (drm_gem_shmem_dumb_create );
541536
0 commit comments