Commit 1f7cb466 authored by Divya Bharathi's avatar Divya Bharathi Committed by Hans de Goede
Browse files

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: default avatarMario Limonciello <mario.limonciello@dell.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@dell.com>
Co-developed-by: default avatarPrasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: default avatarPrasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: default avatarDivya Bharathi <divya.bharathi@dell.com>
Link: https://lore.kernel.org/r/20201202131935.307372-1-divya.bharathi@dell.com


Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent eca6ba20
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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;
}