Re: [PATCH 1/2] rust: drm: ioctl: return Result<i32> from ioctl handlers

From: Danilo Krummrich

Date: Mon Nov 30 2026 - 11:04:21 EST


On 11/30/26 4:35 PM, Gary Guo wrote:
> I asked a clanker to search for the codebase (and I verified), and there're a
> few ioctls that return non-zero on success:
>
> - DRM_IOCTL_I915_PERF_OPEN -- returning a file descriptor
> - DRM_IOCTL_I915_PERF_ADD_CONFIG -- returning a OA config ID
> - DRM_IOCTL_XE_OBSERVATION -- returning FD or OA config ID
> - DRM_IOCTL_MSM_PERFCNTR_CONFIG -- returning a FD
>
> All of them are driver-specific ioctls and according to the clanker none of the
> core ioctls return non-zero on success (unverified).
>
> I think we can define a trait for allowed return values perhaps? Initially just
> implement it for () which converts to 0, and we can add more when it's needed in
> the future.
I think we should keep it simple and just return Result for now; it seems unlikely
we ever need something else.