From patchwork Thu Sep 13 15:06:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10599723 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 1CD7E15A7 for ; Thu, 13 Sep 2018 15:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EC472B0CE for ; Thu, 13 Sep 2018 15:06:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02F1C2B0D0; Thu, 13 Sep 2018 15:06:23 +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 B26AA2B0CE for ; Thu, 13 Sep 2018 15:06:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 10A376E1C4; Thu, 13 Sep 2018 15:06:22 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id B14EA6E1C4 for ; Thu, 13 Sep 2018 15:06:20 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id z96-v6so6202652wrb.8 for ; Thu, 13 Sep 2018 08:06:20 -0700 (PDT) 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=UX8nP6kfDUGdRMuNt+IJEWiOIJzFPDpYLzYkk9Y0yA8=; b=tagi1Sbl7qkMtqYHX9VHgUSOvZeiGdjAIquUPl1wWPXZAeyJv9AGFRje+0CM2SQGoS WT6UleGLU+snzddmHCx40M4044Wu7LWUt0S0KCqxjrw13C5Pz5chy7InDsnx5WaRwRMU wOwb16Ik+tR4jzQLdVUrBJWqNeu7sCCSv0hh6psotexss+6EmCML9PcRaQNYzLvr5tgn JQCrw21p4/12H/X5QWfE9lM/2KvGvqMs9aUfQyaUccpxI5IX6/wbGW6qimbchE0J5X35 HoAIt58QWRsA6n9XlGsw1myUbO6xaJVpsypMhE6FrczVn1XAhGxo8fW+maR9W+DKlGT/ uWNw== X-Gm-Message-State: APzg51AuQffhP8F8oJAbqekqNFcXpA18RhHY6cecvest68ow859gK/ZS AAUugbkKIgBD3BxCV29oktkTKxRljSE= X-Google-Smtp-Source: ANB0VdZ+9kiOvBb6+fSRXwpDdVRMMq3/6FYiQ25qC/1MPenO0uxySU2KATgrM8tiw3OQ4rrv3YX6vA== X-Received: by 2002:adf:82c3:: with SMTP id 61-v6mr5978283wrc.131.1536851179333; Thu, 13 Sep 2018 08:06:19 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.37]) by smtp.gmail.com with ESMTPSA id v46-v6sm5859593wrc.63.2018.09.13.08.06.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Sep 2018 08:06:18 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 13 Sep 2018 16:06:13 +0100 Message-Id: <20180913150613.16265-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [PATH i-g-t] igt_sysfs: Avoid double closing the fd in igt_sysfs_scanf 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 From: Tvrtko Ursulin fdopen takes ownership of the fd so only one flavour of closing it is needed. Signed-off-by: Tvrtko Ursulin Reviewed-by: Chris Wilson --- lib/igt_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c index 9012cc73f6e3..d323b81dd986 100644 --- a/lib/igt_sysfs.c +++ b/lib/igt_sysfs.c @@ -379,8 +379,9 @@ int igt_sysfs_scanf(int dir, const char *attr, const char *fmt, ...) va_end(ap); fclose(file); + } else { + close(fd); } - close(fd); return ret; }