Skip to content

Commit ed85891

Browse files
Wer-Wolfij-intel
authored andcommitted
platform/x86: wmi: Fix probe failure when failing to register WMI devices
When a WMI device besides the first one somehow fails to register, retval is returned while still containing a negative error code. This causes the ACPI device fail to probe, leaving behind zombie WMI devices leading to various errors later. Handle the single error path separately and return 0 unconditionally after trying to register all WMI devices to solve the issue. Also continue to register WMI devices even if some fail to allocate memory. Fixes: 6ee50aa ("platform/x86: wmi: Instantiate all devices before adding them") Signed-off-by: Armin Wolf <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 7444f83 commit ed85891

File tree

1 file changed

+8
-8
lines changed
  • drivers/platform/x86

1 file changed

+8
-8
lines changed

drivers/platform/x86/wmi.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
13381338
struct wmi_block *wblock;
13391339
union acpi_object *obj;
13401340
acpi_status status;
1341-
int retval = 0;
13421341
u32 i, total;
1342+
int retval;
13431343

13441344
status = acpi_evaluate_object(device->handle, "_WDG", NULL, &out);
13451345
if (ACPI_FAILURE(status))
@@ -1350,8 +1350,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
13501350
return -ENXIO;
13511351

13521352
if (obj->type != ACPI_TYPE_BUFFER) {
1353-
retval = -ENXIO;
1354-
goto out_free_pointer;
1353+
kfree(obj);
1354+
return -ENXIO;
13551355
}
13561356

13571357
gblock = (const struct guid_block *)obj->buffer.pointer;
@@ -1366,8 +1366,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
13661366

13671367
wblock = kzalloc(sizeof(*wblock), GFP_KERNEL);
13681368
if (!wblock) {
1369-
retval = -ENOMEM;
1370-
break;
1369+
dev_err(wmi_bus_dev, "Failed to allocate %pUL\n", &gblock[i].guid);
1370+
continue;
13711371
}
13721372

13731373
wblock->acpi_device = device;
@@ -1398,9 +1398,9 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
13981398
}
13991399
}
14001400

1401-
out_free_pointer:
1402-
kfree(out.pointer);
1403-
return retval;
1401+
kfree(obj);
1402+
1403+
return 0;
14041404
}
14051405

14061406
/*

0 commit comments

Comments
 (0)