v2: followed to rafael@'s proposal Fixes: edf5bf34d408 ("ACPI / dock: Use callback pointers from devices' ACPI hotplug contexts") Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx> --- drivers/pci/hotplug/acpiphp_glue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index b4c92cee13f8..a0923a65e636 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -123,7 +123,11 @@ static struct acpiphp_context *acpiphp_grab_context(struct acpi_device *adev) acpi_lock_hp_context(); context = acpiphp_get_context(adev); - if (!context || context->func.parent->is_going_away) { + if (context && context->func.parent->is_going_away) { + acpiphp_put_context(context); + context = NULL; + } + if (!context) { acpi_unlock_hp_context(); return NULL; } -- 2.17.1