From patchwork Tue Nov 29 10:48:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9451449 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 E49AA60710 for ; Tue, 29 Nov 2016 10:49:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEC992811E for ; Tue, 29 Nov 2016 10:49:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E359628173; Tue, 29 Nov 2016 10:49:24 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 73C7E2811E for ; Tue, 29 Nov 2016 10:49:24 +0000 (UTC) Received: from localhost ([::1]:35987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBfyV-00072n-F8 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Nov 2016 05:49:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBfy4-00070R-23 for qemu-devel@nongnu.org; Tue, 29 Nov 2016 05:48:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBfy1-00043a-0u for qemu-devel@nongnu.org; Tue, 29 Nov 2016 05:48:56 -0500 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:33961) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cBfy0-00043A-Qs for qemu-devel@nongnu.org; Tue, 29 Nov 2016 05:48:52 -0500 Received: by mail-qt0-x242.google.com with SMTP id l20so14987004qta.1 for ; Tue, 29 Nov 2016 02:48:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=2FIvR+TcVS+pg/tjxDbV2Bxem9vZzS5fA2LCeVKx5Iw=; b=J2VbM1uZInwNNILfd0GvcYYA08jutIutMHptJ4PhlCu9zpOXbBSk6rEJwh8K5a4PY1 DQGHXQWAgamXIKiilsg0czeFJc8TYxVEp4MmjkLik+7Gj4CAfkTsSRtDPY0Bp5l/HdCy sFJ68Ed76oPaP9o1AueCVeYJtgd7oJkxorkRrcN77omkoHCGZ6S4vV2Wpv+0rpmKrmQz GPRE4E3IbuE2cCgT1sAlESZhd3BarQj0UV1Veymfi4XRAXMOUupKpye0nElCj2tYlaKA FRwy5s7mTCzysw9JY97PsG/HeNfKgC3gi5C0GQbaYnmDqLuXXoX76Emkv6FTgxj5G8GK BoMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=2FIvR+TcVS+pg/tjxDbV2Bxem9vZzS5fA2LCeVKx5Iw=; b=YKyMcbH4AsHSCOMkep9BUtQpbNXZU+LcAhe8uSVe44PKpSY6pZ48dmwXSG72vXenOf ts6YvXTl2k+n5Y9ojhyMTJ0cGBUO9LfKYDnoFCUDG+K5sQf0aLZwpxC27aCYKcFYUaNq 2P22s8JvyLvVPP27MV/fJFVS01WPQOsUrW7pGzQmx3Tbb3mLvo15+QJub10MjqeTbzGp 0iyZDeX9OPreyhmbeF1djzyWTGSbzY2nPpLsYnzILOYXd32jH9WnsqYlAlLGTHp0lp8k hDMe8jEK9uKIYxxZig3kYcwSJSvP1SOQVHmXnqPW22u6k6zOFuzzqH7AAulW5pwDhonU aiaw== X-Gm-Message-State: AKaTC01YKB6vHjHgK291uDEuaIqdT7zHJnCe3x7PfforQGsR3HSlLszxcrh5cJTQBIUhQg== X-Received: by 10.237.40.38 with SMTP id r35mr23749760qtd.0.1480416531706; Tue, 29 Nov 2016 02:48:51 -0800 (PST) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id 5sm30570333qts.47.2016.11.29.02.48.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 02:48:50 -0800 (PST) Message-ID: <583d5d12.8529c80a.4a33a.c6f9@mx.google.com> X-Google-Original-Message-ID: <1480416516-4216-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: kraxel@redhat.com, qemu-devel@nongnu.org Date: Tue, 29 Nov 2016 02:48:36 -0800 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::242 Subject: [Qemu-devel] [PATCH] audio: es1370: add exit function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Li Qiang Currently the es1370 device emulation doesn't have a exit function, hot unplug this device will leak some leak. Add a exit function to avoid this. Signed-off-by: Li Qiang --- hw/audio/es1370.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 8449b5f..8f70f72 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -1041,6 +1041,13 @@ static void es1370_realize(PCIDevice *dev, Error **errp) es1370_reset (s); } +static void es1370_exit(PCIDevice *dev) +{ + ES1370State *s = ES1370(dev); + + AUD_remove_card(&s->card); +} + static int es1370_init (PCIBus *bus) { pci_create_simple (bus, -1, TYPE_ES1370); @@ -1053,6 +1060,7 @@ static void es1370_class_init (ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS (klass); k->realize = es1370_realize; + k->exit = es1370_exit; k->vendor_id = PCI_VENDOR_ID_ENSONIQ; k->device_id = PCI_DEVICE_ID_ENSONIQ_ES1370; k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;