selftests/damon/_damon_sysfs: check errors from nr_schemes file reads
BugLink: https://bugs.launchpad.net/bugs/2071621
[ 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: f5f0e5a2be ("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>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
This commit is contained in:
committed by
Stefan Bader
parent
ee5c82e379
commit
71bcf68d24
@@ -241,6 +241,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:
|
||||
|
||||
Reference in New Issue
Block a user