mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Add safe ops func for cast s32 to u64
JIRA NVGPU-3482 Change-Id: Iff3dd13132057d3ed89c2955c31f3e14bf6cfeda Signed-off-by: Seeta Rama Raju <srajum@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2137505 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Ankur Kishore <ankkishore@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
29ec6ad40f
commit
3ca084ae65
@@ -200,6 +200,15 @@ static inline u32 nvgpu_safe_cast_s32_to_u32(s32 si_a)
|
||||
}
|
||||
}
|
||||
|
||||
static inline u64 nvgpu_safe_cast_s32_to_u64(s32 si_a)
|
||||
{
|
||||
if (si_a < 0) {
|
||||
BUG();
|
||||
} else {
|
||||
return (u64)si_a;
|
||||
}
|
||||
}
|
||||
|
||||
static inline u16 nvgpu_safe_cast_u32_to_u16(u32 ui_a)
|
||||
{
|
||||
if (ui_a > USHRT_MAX) {
|
||||
|
||||
Reference in New Issue
Block a user