Received: by 10.213.65.68 with SMTP id h4csp1156184imn; Wed, 4 Apr 2018 13:40:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx48kEHPKpEwpSGVzGDWqKgWPJNOzrh0wAIGW5OxCH07Q0FNz+9FGZ8Jfvg3hiCP+vQuKLtGQ X-Received: by 2002:a17:902:24:: with SMTP id 33-v6mr20073527pla.341.1522874411603; Wed, 04 Apr 2018 13:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522874411; cv=none; d=google.com; s=arc-20160816; b=0pP+WU684q32Z0MTueDIgj+FGeYk6zAn5+bIpzrYiVYE+7RgUqUDjBqeXuz0AemT8E 5g/dddEOnuP1MtWeUTIwTB15zBfsBcF9NVjwTm6j72J+j/I0V8FP+zX+4kBjY+JOkT8/ bx4gLs3m7S0W2YtgxbIZBp+Y2axnryfACoJ/+TmDSsMHWloqQks6Ua1ZRrJkjnA6T9Zg fCG8qzlwgJcdWoqKAKl/9edKT03Sz2zkOLsTGZRpDanqDh6g1b3m3cPWxX5pvfgbAlvL cg9+6SczOnrUcP0zytXXentHuh7ucJ1VmdiVe6t9+CfJaRSrUUJnUJeJafbOFhMQTW5r U1kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=8d8q423GvYIzGfZuk72vmpKXIiKL4Oiy4Ao+dqPebgk=; b=nRuIfHGUQAN/ngiZQZTkqmKcu5aA2H4ZZY5+3Ea6mYZ0iFLJku6PgTnASW43U/3L6L S9gaCntAamhI9gMgr7kmGO7SL+9uM0/Rwkj0jSj0wjCmjfqEhsTxTyiY0vqlBY0ZPf4i zRMV7s8KnebnVoVmdhlFrF5GZYLZ8ZmLXcZOm5QC1I+BRA9iBtVSZqaLPFgUE/U213+F +7Zc/fOY+nxm5QR+Y16LMjw1HlYigCP5kFUDIQon7pmXbR/iOW9fT35WPAfmS/w0j/3l qBqBeRJGbg/gN9BmewzcSFWQAwHjUNHxELbMGF+vOJvpyaKaUwV0e2D/vm6rMgT6ubI2 P5zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l62si4191209pga.740.2018.04.04.13.39.57; Wed, 04 Apr 2018 13:40:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752077AbeDDUiz (ORCPT + 99 others); Wed, 4 Apr 2018 16:38:55 -0400 Received: from imap1.codethink.co.uk ([176.9.8.82]:55114 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751871AbeDDUix (ORCPT ); Wed, 4 Apr 2018 16:38:53 -0400 Received: from 92.40.249.109.threembb.co.uk ([92.40.249.109] helo=xylophone.i.decadent.org.uk) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1f3pBD-0002UV-Kd; Wed, 04 Apr 2018 21:38:51 +0100 Date: Wed, 4 Apr 2018 22:38:49 +0200 From: Ben Hutchings To: Greg Kroah-Hartman , "Luis R. Rodriguez" Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH driver-core 2/2] test_firmware: fix setting old custom fw path back on exit, second try Message-ID: <20180404203848.3txsangsvaxtxsu4@xylophone.i.decadent.org.uk> References: <20180404203712.zecit6po44qsde4c@xylophone.i.decadent.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180404203712.zecit6po44qsde4c@xylophone.i.decadent.org.uk> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 65c79230576 tried to clear the custom firmware path on exit by writing a single space to the firmware_class.path parameter. This doesn't work because nothing strips this space from the value stored and fw_get_filesystem_firmware() only ignores zero-length paths. Instead, write a null byte. Fixes: 0a8adf58475 ("test: add firmware_class loader test") Fixes: 65c79230576 ("test_firmware: fix setting old custom fw path back on exit") Signed-off-by: Ben Hutchings --- tools/testing/selftests/firmware/fw_lib.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh index 9ea31b57d71a..962d7f4ac627 100755 --- a/tools/testing/selftests/firmware/fw_lib.sh +++ b/tools/testing/selftests/firmware/fw_lib.sh @@ -154,11 +154,13 @@ test_finish() if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout fi - if [ "$OLD_FWPATH" = "" ]; then - OLD_FWPATH=" " - fi if [ "$TEST_REQS_FW_SET_CUSTOM_PATH" = "yes" ]; then - echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path + if [ "$OLD_FWPATH" = "" ]; then + # A zero-length write won't work; write a null byte + printf '\000' >/sys/module/firmware_class/parameters/path + else + echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path + fi fi if [ -f $FW ]; then rm -f "$FW" -- 2.16.2