On an AMD based Lenovo T14, I find that the module doesn't work at all, and instead has a traceback with messages like: ``` sysfs: cannot create duplicate filename '/devices/virtual/firmware-attributes/thinklmi/attributes/Reserved' ``` Check for duplicates before adding any attributes. Fixes: a40cd7ef22fb ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms") Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx> --- drivers/platform/x86/think-lmi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index d2644230b91f..b029d4a5bc3c 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -691,6 +691,13 @@ static int tlmi_sysfs_init(void) if (!tlmi_priv.setting[i]) continue; + /* check for duplicate */ + if (kset_find_obj(tlmi_priv.attribute_kset, tlmi_priv.setting[i]->display_name)) { + pr_debug("duplicate attribute name found - %s\n", + tlmi_priv.setting[i]->display_name); + continue; + } + /* Build attribute */ tlmi_priv.setting[i]->kobj.kset = tlmi_priv.attribute_kset; ret = kobject_init_and_add(&tlmi_priv.setting[i]->kobj, &tlmi_attr_setting_ktype, -- 2.25.1