diff options
author | SeongJae Park <sj@kernel.org> | 2024-05-03 11:03:10 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-05-30 09:45:00 +0200 |
commit | cf640a9d52e780468ee403ff7fee8e04d7914c35 (patch) | |
tree | b7496932e5b494639f130e46ce034fdbb73dc5d5 | |
parent | 8ca148915670a2921afcc255af9e1dc80f37b052 (diff) |
selftests/damon/_damon_sysfs: check errors from nr_schemes file reads
[ Upstream commit 732b8815c079199d29b0426d9372bb098c63cdc7 ]
DAMON context staging method in _damon_sysfs.py is not checking the
returned error from nr_schemes file read. Check it.
Link: https://lkml.kernel.org/r/20240503180318.72798-3-sj@kernel.org
Fixes: f5f0e5a2bef9 ("selftests/damon/_damon_sysfs: implement kdamonds start function")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | tools/testing/selftests/damon/_damon_sysfs.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py index d23d7398a27a..fe77d7e73a25 100644 --- a/tools/testing/selftests/damon/_damon_sysfs.py +++ b/tools/testing/selftests/damon/_damon_sysfs.py @@ -287,6 +287,8 @@ class DamonCtx: nr_schemes_file = os.path.join( self.sysfs_dir(), 'schemes', 'nr_schemes') content, err = read_file(nr_schemes_file) + if err is not None: + return err if int(content) != len(self.schemes): err = write_file(nr_schemes_file, '%d' % len(self.schemes)) if err != None: |