aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDivya Bharathi <[email protected]>2020-12-02 18:49:35 +0530
committerHans de Goede <[email protected]>2020-12-07 16:09:28 +0100
commit1f7cb4665df8a25ae577a822a47fc4576f60c30f (patch)
tree783a1c08b2d1a6f3eba7e5fd3ac1e85e5c1ac630
parenteca6ba20f38cfa2f148d7bd13db7ccd19e88635b (diff)
platform/x86: dell-wmi-sysman: work around for BIOS bug
BIOS sets incorrect value (zero) when SET value passed for integer attribute with + sign. Added workaround to remove + sign before passing input to BIOS. Co-developed-by: Mario Limonciello <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Co-developed-by: Prasanth KSR <[email protected]> Signed-off-by: Prasanth KSR <[email protected]> Signed-off-by: Divya Bharathi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
-rw-r--r--drivers/platform/x86/dell-wmi-sysman/int-attributes.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
index ea773d8e8d3a..75aedbb733be 100644
--- a/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
+++ b/drivers/platform/x86/dell-wmi-sysman/int-attributes.c
@@ -39,7 +39,7 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
* @instance_id: The instance on which input is validated
* @buf: Input value
*/
-static int validate_integer_input(int instance_id, const char *buf)
+static int validate_integer_input(int instance_id, char *buf)
{
int in_val;
int ret;
@@ -51,6 +51,12 @@ static int validate_integer_input(int instance_id, const char *buf)
in_val > wmi_priv.integer_data[instance_id].max_value)
return -EINVAL;
+ /* workaround for BIOS error.
+ * validate input to avoid setting 0 when integer input passed with + sign
+ */
+ if (*buf == '+')
+ memmove(buf, (buf + 1), strlen(buf + 1) + 1);
+
return ret;
}