if (res)
return res;
- temp /= 1000;
+ temp = DIV_ROUND_CLOSEST(temp, 1000);
if (temp > resource->caps.max_cap || temp < resource->caps.min_cap)
return -EINVAL;
arg0.integer.value = temp;
if (res)
return res;
- temp /= 1000;
- if (temp < 0)
+ temp = DIV_ROUND_CLOSEST(temp, 1000);
+ if (temp > INT_MAX)
return -EINVAL;
mutex_lock(&resource->lock);