Negative values are special.  Don't let users write them directly.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
        s32 value;
        int ret;
 
-       if (kstrtos32(buf, 0, &value)) {
+       if (kstrtos32(buf, 0, &value) == 0) {
+               /* Users can't write negative values directly */
+               if (value < 0)
+                       return -EINVAL;
+       } else {
                if (!strcmp(buf, "auto") || !strcmp(buf, "auto\n"))
                        value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
                else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))