*/
int pass_hal_set_online_state(struct pass_resource *res, int cpu, int on)
{
- if (!res || cpu < 0 || on < 0)
+ if (!res || cpu < 0)
+ return -EINVAL;
+
+ if (on != 0 && on != 1)
return -EINVAL;
return hal_power_hotplug_set_online_state(res->config_data.res_type,
*/
int pass_hal_set_cooling_device_state(struct pass_resource *res, int state)
{
- if (!res)
+ if (!res || state < 0)
return -EINVAL;
/*
*/
int pass_hal_set_battery_charging_status(struct pass_resource *res, int charging_status)
{
- if (!res)
+ if (!res || charging_status < 0)
return -EINVAL;
return hal_power_battery_set_charging_status(res->config_data.res_type,
int pass_hal_set_battery_charging_current(struct pass_resource *res,
int charging_current_uA)
{
- if (!res)
+ if (!res || charging_current_uA <= 0)
return -EINVAL;
return hal_power_battery_set_charging_current(res->config_data.res_type,
int pass_hal_set_fault_around_bytes(struct pass_resource *res,
int fault_around_bytes)
{
- if (!res)
+ if (!res || fault_around_bytes <= 0)
return -EINVAL;
return hal_power_memory_set_fault_around_bytes(res->config_data.res_type,