Skip to content

Commit 8dfab52

Browse files
committed
Merge tag 'platform-drivers-x86-v6.3-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: - more think-lmi fixes - one DMI quirk addition * tag 'platform-drivers-x86-v6.3-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: thinkpad_acpi: Add missing T14s Gen1 type to s2idle quirk list platform/x86: think-lmi: Clean up display of current_value on Thinkstation platform/x86: think-lmi: Fix memory leaks when parsing ThinkStation WMI strings platform/x86: think-lmi: Fix memory leak when showing current settings
2 parents fcff5f9 + 9a469c6 commit 8dfab52

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

drivers/platform/x86/think-lmi.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *at
920920
static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
921921
{
922922
struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
923-
char *item, *value;
923+
char *item, *value, *p;
924924
int ret;
925925

926926
ret = tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID);
@@ -930,10 +930,15 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
930930
/* validate and split from `item,value` -> `value` */
931931
value = strpbrk(item, ",");
932932
if (!value || value == item || !strlen(value + 1))
933-
return -EINVAL;
934-
935-
ret = sysfs_emit(buf, "%s\n", value + 1);
933+
ret = -EINVAL;
934+
else {
935+
/* On Workstations remove the Options part after the value */
936+
p = strchrnul(value, ';');
937+
*p = '\0';
938+
ret = sysfs_emit(buf, "%s\n", value + 1);
939+
}
936940
kfree(item);
941+
937942
return ret;
938943
}
939944

@@ -1457,10 +1462,10 @@ static int tlmi_analyze(void)
14571462
* name string.
14581463
* Try and pull that out if it's available.
14591464
*/
1460-
char *item, *optstart, *optend;
1465+
char *optitem, *optstart, *optend;
14611466

1462-
if (!tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID)) {
1463-
optstart = strstr(item, "[Optional:");
1467+
if (!tlmi_setting(setting->index, &optitem, LENOVO_BIOS_SETTING_GUID)) {
1468+
optstart = strstr(optitem, "[Optional:");
14641469
if (optstart) {
14651470
optstart += strlen("[Optional:");
14661471
optend = strstr(optstart, "]");
@@ -1469,6 +1474,7 @@ static int tlmi_analyze(void)
14691474
kstrndup(optstart, optend - optstart,
14701475
GFP_KERNEL);
14711476
}
1477+
kfree(optitem);
14721478
}
14731479
}
14741480
/*

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4478,6 +4478,14 @@ static const struct dmi_system_id fwbug_list[] __initconst = {
44784478
DMI_MATCH(DMI_PRODUCT_NAME, "20UH"),
44794479
}
44804480
},
4481+
{
4482+
.ident = "T14s Gen1 AMD",
4483+
.driver_data = &quirk_s2idle_bug,
4484+
.matches = {
4485+
DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
4486+
DMI_MATCH(DMI_PRODUCT_NAME, "20UJ"),
4487+
}
4488+
},
44814489
{
44824490
.ident = "P14s Gen1 AMD",
44834491
.driver_data = &quirk_s2idle_bug,

0 commit comments

Comments
 (0)