Skip to contentSkip to conversation

platform/x86: dell-wmi-sysman: work around for BIOS bug

PATCH In review Divya Bharathi 2 participants 2 messages Dec 2, 2020 – Dec 7, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 drivers/platform/x86/dell-wmi-sysman/int-attributes.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/x86/dell-wmi-sysman/int-attributes.c +7 -1
index ea773d8e8d3a..75aedbb733be 100644
@@ -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;
 }
 
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 8 lines · Divya Bharathi

BIOS sets incorrect value (zero) when SET value passed for integer attribute with + sign. Added workaround to remove + sign before passing input to BIOS

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 31 lines
---
 drivers/platform/x86/dell-wmi-sysman/int-attributes.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/x86/dell-wmi-sysman/int-attributes.c +7 -1
index ea773d8e8d3a..75aedbb733be 100644
@@ -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;
 }