diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs index e603859ff67..d323e9a1357 100644 --- a/src/gallium/frontends/rusticl/api/device.rs +++ b/src/gallium/frontends/rusticl/api/device.rs @@ -393,12 +393,14 @@ fn get_device_ids( } #[cl_entrypoint(clRetainDevice)] -fn retain_device(_device: cl_device_id) -> CLResult<()> { +fn retain_device(device: cl_device_id) -> CLResult<()> { + let _ = Device::ref_from_raw(device)?; Ok(()) } #[cl_entrypoint(clReleaseDevice)] -fn release_device(_device: cl_device_id) -> CLResult<()> { +fn release_device(device: cl_device_id) -> CLResult<()> { + let _ = Device::ref_from_raw(device)?; Ok(()) } diff --git a/src/gallium/frontends/rusticl/api/util.rs b/src/gallium/frontends/rusticl/api/util.rs index 7243d1a6dd4..fe8c2c91e61 100644 --- a/src/gallium/frontends/rusticl/api/util.rs +++ b/src/gallium/frontends/rusticl/api/util.rs @@ -440,7 +440,7 @@ const CL_DEVICE_TYPES: u32 = CL_DEVICE_TYPE_ACCELERATOR pub fn check_cl_device_type(val: cl_device_type) -> CLResult<()> { let v: u32 = val.try_into().or(Err(CL_INVALID_DEVICE_TYPE))?; - if v == CL_DEVICE_TYPE_ALL || v & CL_DEVICE_TYPES == v { + if v != 0 && (v == CL_DEVICE_TYPE_ALL || v & CL_DEVICE_TYPES == v) { return Ok(()); } Err(CL_INVALID_DEVICE_TYPE)