Skip to content

Commit ba6976c

Browse files
committed
drm: Convert drm_legacy_ctxbitmap_init to void return type
It can't fail really. Also remove the redundant kms check Peter added. Cc: Peter Antoine <peter.antoine@intel.com> Reviewed-by: Peter Antoine <peter.antoine@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
1 parent 0e97598 commit ba6976c

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

drivers/gpu/drm/drm_context.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
8989
*
9090
* Initialise the drm_device::ctx_idr
9191
*/
92-
int drm_legacy_ctxbitmap_init(struct drm_device * dev)
92+
void drm_legacy_ctxbitmap_init(struct drm_device * dev)
9393
{
9494
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
9595
drm_core_check_feature(dev, DRIVER_MODESET))
96-
return -EINVAL;
96+
return;
9797

9898
idr_init(&dev->ctx_idr);
99-
return 0;
10099
}
101100

102101
/**

drivers/gpu/drm/drm_drv.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -582,14 +582,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
582582
if (drm_ht_create(&dev->map_hash, 12))
583583
goto err_minors;
584584

585-
if (drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) ||
586-
!drm_core_check_feature(dev, DRIVER_MODESET))
587-
ret = drm_legacy_ctxbitmap_init(dev);
588-
if (ret) {
589-
DRM_ERROR(
590-
"Cannot allocate memory for context bitmap.\n");
591-
goto err_ht;
592-
}
585+
drm_legacy_ctxbitmap_init(dev);
593586

594587
if (drm_core_check_feature(dev, DRIVER_GEM)) {
595588
ret = drm_gem_init(dev);
@@ -603,7 +596,6 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
603596

604597
err_ctxbitmap:
605598
drm_legacy_ctxbitmap_cleanup(dev);
606-
err_ht:
607599
drm_ht_remove(&dev->map_hash);
608600
err_minors:
609601
drm_minor_free(dev, DRM_MINOR_LEGACY);

drivers/gpu/drm/drm_legacy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct drm_file;
4242
#define DRM_KERNEL_CONTEXT 0
4343
#define DRM_RESERVED_CONTEXTS 1
4444

45-
int drm_legacy_ctxbitmap_init(struct drm_device *dev);
45+
void drm_legacy_ctxbitmap_init(struct drm_device *dev);
4646
void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
4747
void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
4848
void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);

0 commit comments

Comments
 (0)