Skip to content

Commit b216a8e

Browse files
Qiujun Huangdanvet
authored andcommitted
drm/lease: fix WARNING in idr_destroy
drm_lease_create takes ownership of leases. And leases will be released by drm_master_put. drm_master_put ->drm_master_destroy ->idr_destroy So we needn't call idr_destroy again. Reported-and-tested-by: [email protected] Signed-off-by: Qiujun Huang <[email protected]> Cc: [email protected] Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 8c34cd1 commit b216a8e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/drm_lease.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,12 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
542542
}
543543

544544
DRM_DEBUG_LEASE("Creating lease\n");
545+
/* lessee will take the ownership of leases */
545546
lessee = drm_lease_create(lessor, &leases);
546547

547548
if (IS_ERR(lessee)) {
548549
ret = PTR_ERR(lessee);
550+
idr_destroy(&leases);
549551
goto out_leases;
550552
}
551553

@@ -580,7 +582,6 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
580582

581583
out_leases:
582584
put_unused_fd(fd);
583-
idr_destroy(&leases);
584585

585586
DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret);
586587
return ret;

0 commit comments

Comments
 (0)