Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38390163rwd; Wed, 12 Jul 2023 07:07:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlEathMZfvd93JXWIwPCHcxVKEve0STDMK6vhxS1A879qvcGjMxcGWj4pNi2eTlxR0IGr8Fz X-Received: by 2002:a05:6a20:8e0b:b0:127:24f8:bdfa with SMTP id y11-20020a056a208e0b00b0012724f8bdfamr17915572pzj.31.1689170835865; Wed, 12 Jul 2023 07:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689170835; cv=none; d=google.com; s=arc-20160816; b=GOhy1x1fDpKddfZDmkapsR3tT/rJJ3DwSRbDay+p0aEbs5YQQWyLLtd6nJR4/5Xuw1 rsUulJIPLZW5B+LJHmV7Ff+izxdMczbQ/Ue2jmYJ6jwLJKnlM3ag8kDZkpWKMPtQIF95 TBBwKt+S+m+608tPiJmYWDuopsvJRKY+LjAGpqVhRxeQsfQ6D10Z000/2WwCdOMisLXK k/opfTfgZL61evioI+flmtv+PwAnb6tIY47QpaqgBMYylRgGurVDrZw7v4cMw7vfZC1m 0P9auBKtK5ZAQoPt/3Ggld7JdpZ8mcguolJxE6t5/2MQCWPrZRN7e7oDyf840RMjDYOd h8zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Fe/Z+3ZtV+7rEEbA5ujf7MvOol2TwmyPnYuPdYc8Nwg=; fh=Lw0gCB7belccjTtoDsEWSjdvt2JnwdWSevYEg0WoxVc=; b=WbU/rAGz9HzYcQJ7U/7XW1gxyqDnEA/O/bWDTVe1K46RUZBlvlbR48rzFO08g6YUK/ h2pghE7aOu1IJ6MFUOx3vEWhBKKbH2+OJA+xlIP78e/lnzryqwSf1+tpEqnArrPA8bkq ZBpkPs+Rp1zyGKrQTKoPEA6XdNsXq9GTm0/PGi1/gb73c2iSzHVZVsmlL9Z6eVz13+Su uLfwoOSTV2XkDoAcvQKEocqbJK4JhPT7PgMKUUwxgfavfxYSrGtF2Jw7HK4U18D1M0LP P6/6j0oT1+vi0yokhrwtqY5YAfR7pIsljX1GTs6MWFJp0BsWugagQZHH7Xw7E+PyPcpe Yqag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UiX61zfF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a637702000000b005576ebe803bsi3224524pgc.319.2023.07.12.07.07.01; Wed, 12 Jul 2023 07:07:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UiX61zfF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232358AbjGLOCK (ORCPT + 99 others); Wed, 12 Jul 2023 10:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233349AbjGLOBg (ORCPT ); Wed, 12 Jul 2023 10:01:36 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DD9F19BE; Wed, 12 Jul 2023 07:01:26 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbf1b82dc7so71733595e9.2; Wed, 12 Jul 2023 07:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689170484; x=1691762484; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Fe/Z+3ZtV+7rEEbA5ujf7MvOol2TwmyPnYuPdYc8Nwg=; b=UiX61zfF22NdJKf458JphAbi6m+mWH28KarzHGFtUyEVhXabazOSNAkurpgz5quMnl izUUZNQJJXMbmbtgB1bl4o9YSib/GV5m5jD54AQmzsi5Xz4NAoCrHjqthsSde3sidZXT Bk6xEDMjY+ny22PFJzjXXmkcS02rSo8B0wnA6YRoiFdR1UXtiNOIA/kC3XBjeEzryjFx /bUmYpKgnQGso1HekqStoMn2S9aWHyFNPb4Q4/m8TeqdfdH7hLJKw3qLiSr4ttzspj/9 0H+9IQgjST/1GgGohMsheteYm26A2XZaSiuSjO29zVVmE8ETfPKF9NBS+6f6ROGS59Wx AoqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689170484; x=1691762484; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Fe/Z+3ZtV+7rEEbA5ujf7MvOol2TwmyPnYuPdYc8Nwg=; b=c/r7ywFU5/fmxYACKQTB4Kq7PrNguHegJ72k3ZfORWmVrg/7RZT09gqyjoPZ2lYL/Y 75J/WwlOtEUR6aWeiVZf0iHkkKZSFpWnXQdK+u/fhCDhmf4TQgq0pPK0GXrFp3EPZDAd v4Vbverz0mDLGHERqL22BVZ64hqE7mKvpRbHc1Z+vV1g/zXuQtmE7bHWfMgTGu/WLi+u PMh4mfn1102XNHnLFRo+AwUSvJfaOamkTnUx23uUzELVRAB0fXWRQ9hiGkBlgKmDmwfS 5qMvHoAjA4RU0dI7CZRI17CKIzB4/uy2S/Qh02dCrbSNJaKGNsr3slfgDgPniiPprtOX V3ZA== X-Gm-Message-State: ABy/qLbXdwm6C5FO9TKrm3RsW6eYMzhY0xPM1cY4B5H3jD81m23Y2OZv b/nHid/L+KPIIVg2hvKnp+o= X-Received: by 2002:a7b:c451:0:b0:3fb:b4fc:be62 with SMTP id l17-20020a7bc451000000b003fbb4fcbe62mr17218287wmi.17.1689170484340; Wed, 12 Jul 2023 07:01:24 -0700 (PDT) Received: from localhost (cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net. [80.193.200.194]) by smtp.gmail.com with ESMTPSA id h6-20020a05600c314600b003fa9a00d74csm2318867wmo.3.2023.07.12.07.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 07:01:23 -0700 (PDT) From: Colin Ian King To: Ivan Orlov , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shuah Khan , alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] selftests: ALSA: Fix fclose on an already fclosed file pointer Date: Wed, 12 Jul 2023 15:01:22 +0100 Message-Id: <20230712140122.457206-1-colin.i.king@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the case where a sysfs file cannot be opened the error return path fcloses file pointer fpl, however, fpl has already been closed in the previous stanza. Fix the double fclose by removing it. Fixes: 10b98a4db11a ("selftests: ALSA: Add test for the 'pcmtest' driver") Signed-off-by: Colin Ian King --- tools/testing/selftests/alsa/test-pcmtest-driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/testing/selftests/alsa/test-pcmtest-driver.c b/tools/testing/selftests/alsa/test-pcmtest-driver.c index 71931b240a83..357adc722cba 100644 --- a/tools/testing/selftests/alsa/test-pcmtest-driver.c +++ b/tools/testing/selftests/alsa/test-pcmtest-driver.c @@ -47,10 +47,8 @@ static int read_patterns(void) sprintf(pf, "/sys/kernel/debug/pcmtest/fill_pattern%d", i); fp = fopen(pf, "r"); - if (!fp) { - fclose(fpl); + if (!fp) return -1; - } fread(patterns[i].buf, 1, patterns[i].len, fp); fclose(fp); } -- 2.39.2