From patchwork Sat Jun 3 07:38:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 9764007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EF6B60363 for ; Sat, 3 Jun 2017 07:39:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E66B1FF28 for ; Sat, 3 Jun 2017 07:39:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1000927F3E; Sat, 3 Jun 2017 07:39:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B61511FF28 for ; Sat, 3 Jun 2017 07:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751180AbdFCHjK (ORCPT ); Sat, 3 Jun 2017 03:39:10 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34470 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167AbdFCHjK (ORCPT ); Sat, 3 Jun 2017 03:39:10 -0400 Received: by mail-pf0-f195.google.com with SMTP id w69so14995013pfk.1; Sat, 03 Jun 2017 00:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5sJEhs4n9yE74t7tbEjhJD+otiKHDXcVda1qbhM+6rs=; b=drZoxRwMY7oY9pRKvDbRjQUgSFuEIZruQxoYKBfOIzDOFgNMKjlFZR0DKzWCdwY8Ke 3J4mQtOl9trf3DEyhV2U7GhgRDS0VZIGruw63lXHyJtGo1dj3SfXS7ADzxBRGwSoGIIT ie2GgHrjtVAfrct7gsEc0J/Rkeu2QKEwIqxpFUGRYryRdLap9XWUnovwzcj2bXYv/5G0 qY9uU9fOycuy/9aG9rsYAXDaQsJ/yVAn0uqJzDwXfjo4sta94jPIk5L4m66j93Q2LOVc YKKaVi4dirlqWP7AuPhIb6un7PMmZ2yXOyJvyTFMjuozVBDualf1RxD4uTbhxw5tIWZ0 Nq+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5sJEhs4n9yE74t7tbEjhJD+otiKHDXcVda1qbhM+6rs=; b=N7JJlmz1tcMCeBPw41Zp/QY6thk/GZ8/tkV1QJiSGsw52e+p1xGANyw/Tf+t0xQFx5 /Rqe2qY5UTgVTshmugbNFSTwBGwtVteoMGroDRC6t0IUtJ4vJ8EvYDdAe4vjB+CZGw2N gddU+lFIcfB9ogUfF8f+iGsjToBY7lKnwg0b2LfDEhfUsbLCIp1mUrN8PLID9wYQedJ5 rXJj684FomaQ50UaqR7wKcjKkJ4TjVxluSb9noG5+cjaMKYrELasKv7HtLJRXZd1yQ85 7oZkJ5WL7jBUeCrIH/iJEnKNXa6Kl9eZgqMmnEyszWehIkS9VSNDz1ok9cYYDhwZyqGJ m24A== X-Gm-Message-State: AODbwcBkHAEn/+x7fj/oqXv1uY70ZkixmNHIQ86O49q4GG32OKjtpxkk ggSu2ZrbkhjXE/R9 X-Received: by 10.84.232.71 with SMTP id f7mr3882908pln.252.1496475549511; Sat, 03 Jun 2017 00:39:09 -0700 (PDT) Received: from linux-uc2j.site ([124.11.22.254]) by smtp.gmail.com with ESMTPSA id q25sm41470840pgn.9.2017.06.03.00.39.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 03 Jun 2017 00:39:08 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: "Rafael J . Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" , Len Brown Subject: [PATCH] acpi: handle the acpi hotplug schedule error Date: Sat, 3 Jun 2017 15:38:58 +0800 Message-Id: <20170603073858.2332-1-jlee@suse.com> X-Mailer: git-send-email 2.10.2 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Kernel should the decrement reference count of acpi device when acpi hotplug work scheduling is failed. And, kernel should evaluates _OST to notify BIOS the failure. Cc: "Rafael J. Wysocki" Cc: Len Brown Signed-off-by: "Lee, Chun-Yi" --- drivers/acpi/bus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 34fbe02..2f2cec9 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -427,8 +427,14 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) driver->ops.notify(adev, type); - if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type))) - return; + if (hotplug_event) { + if (ACPI_FAILURE(acpi_hotplug_schedule(adev, type))) { + acpi_bus_put_acpi_device(adev); + goto err; + } else { + return; + } + } acpi_bus_put_acpi_device(adev); return;