@@ -296,8 +296,17 @@ static ssize_t enable_store(struct kobject *kobj, struct kobj_attribute *attr,
return -ENODEV;
ret = kstrtoul(buf, 0, &val);
- if (ret)
+ if (ret) {
return ret;
+ }
+
+ if (val != 0 && val != 1) {
+ dev_err(
+ data->client ? &data->client->dev : NULL,
+ "Invalid value: %lu. Only 0 (disable) or 1 (enable) are accepted\n",
+ val);
+ return -EINVAL;
mutex_lock(&data->lock);