[PATCH v3] drm: use get_random_u64() where appropriate

From: David Carlier

Date: Sun Apr 05 2026 - 11:47:25 EST


Use the typed random integer helpers instead of
get_random_bytes() when filling a single integer variable.
The helpers return the value directly, require no pointer
or size argument, and better express intent.

Signed-off-by: David Carlier <devnexen@xxxxxxxxx>
---
drivers/gpu/drm/i915/i915_hdcp_gsc.c | 2 +-
drivers/gpu/drm/xe/xe_gsc_submit.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_hdcp_gsc.c b/drivers/gpu/drm/i915/i915_hdcp_gsc.c
index 168b9ccbef3e..a0510f5ab25c 100644
--- a/drivers/gpu/drm/i915/i915_hdcp_gsc.c
+++ b/drivers/gpu/drm/i915/i915_hdcp_gsc.c
@@ -196,7 +196,7 @@ static ssize_t intel_hdcp_gsc_msg_send(struct intel_hdcp_gsc_context *gsc_contex

memset(header_in, 0, msg_size_in);
memset(header_out, 0, msg_size_out);
- get_random_bytes(&host_session_id, sizeof(u64));
+ host_session_id = get_random_u64();
intel_gsc_uc_heci_cmd_emit_mtl_header(header_in, HECI_MEADDRESS_HDCP,
msg_size_in, host_session_id);
memcpy(gsc_context->hdcp_cmd_in + sizeof(*header_in), msg_in, msg_in_len);
diff --git a/drivers/gpu/drm/xe/xe_gsc_submit.c b/drivers/gpu/drm/xe/xe_gsc_submit.c
index 08082b596501..195f99e6c3a8 100644
--- a/drivers/gpu/drm/xe/xe_gsc_submit.c
+++ b/drivers/gpu/drm/xe/xe_gsc_submit.c
@@ -49,7 +49,7 @@ u64 xe_gsc_create_host_session_id(void)
{
u64 host_session_id;

- get_random_bytes(&host_session_id, sizeof(u64));
+ host_session_id = get_random_u64();
host_session_id &= ~HOST_SESSION_CLIENT_MASK;
return host_session_id;
}
--
2.53.0