From patchwork Wed Aug 15 20:59:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10566851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C6DD213B4 for ; Wed, 15 Aug 2018 20:59:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 822112AB77 for ; Wed, 15 Aug 2018 20:59:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 764FD2ABA7; Wed, 15 Aug 2018 20:59:39 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3EF3A2AB77 for ; Wed, 15 Aug 2018 20:59:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4154B6E41B; Wed, 15 Aug 2018 20:59:38 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id F18FC6E416; Wed, 15 Aug 2018 20:59:33 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 12935348-1500050 for multiple; Wed, 15 Aug 2018 21:59:28 +0100 From: Chris Wilson To: igt-dev@lists.freedesktop.org Date: Wed, 15 Aug 2018 21:59:23 +0100 Message-Id: <20180815205924.6949-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 Subject: [Intel-gfx] [PATCH i-g-t 1/2] igt/pm_rpm: Close local fd before trying to unload module X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Make sure everything we open in setup_environment() is paired to teardown_environment(). Fixes: d8e78990aa2b ("igt/pm_rpm: Test reaquisition of runtime-pm after module reload") Signed-off-by: Chris Wilson --- tests/pm_rpm.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 65489bcdb..c0212ed70 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -717,21 +717,23 @@ out: return wait_for_suspended(); } -static void restore_environment(void) +static void teardown_environment(void) { + close(msr_fd); + if (has_pc8) + close(pc8_status_fd); + + igt_restore_runtime_pm(); + igt_pm_restore_sata_link_power_management(pm_data); free(pm_data); -} -static void teardown_environment(void) -{ - restore_environment(); fini_mode_set_data(&ms_data); + close(debugfs); - drmClose(drm_fd); - close(msr_fd); - if (has_pc8) - close(pc8_status_fd); + close(drm_fd); + + has_runtime_pm = false; } static void basic_subtest(void)