diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5be4a035cb15..3b651fb1807e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -65,7 +65,7 @@ struct screen_monitor { struct screen_monitor sm; #endif -static atomic_t switch_mode = ATOMIC_INIT(-1); +static atomic_t switch_mode = ATOMIC_INIT(10); static atomic_t temp_state = ATOMIC_INIT(0); static char boost_buf[128]; const char *board_sensor; @@ -1683,12 +1683,15 @@ static ssize_t thermal_sconfig_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { - int val = -1; + int ret, val = -1; - val = simple_strtol(buf, NULL, 10); + ret = kstrtoint(buf, 10, &val); atomic_set(&switch_mode, val); + if (ret) + return ret; + return len; } @@ -1725,12 +1728,15 @@ static ssize_t thermal_temp_state_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { - int val = -1; + int ret, val = -1; - val = simple_strtol(buf, NULL, 10); + ret = kstrtoint(buf, 10, &val); atomic_set(&temp_state, val); + if (ret) + return ret; + return len; }