Skip to content

Commit

Permalink
selftests/damon/_damon_sysfs: check errors from nr_schemes file reads
Browse files Browse the repository at this point in the history
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: f5f0e5a ("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>
  • Loading branch information
sjp38 authored and akpm00 committed May 11, 2024
1 parent b96a303 commit 732b881
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/testing/selftests/damon/_damon_sysfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ def stage(self):
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:
Expand Down

0 comments on commit 732b881

Please sign in to comment.