]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
regmap: kunit: Ensure that changed bytes are actually different
authorMark Brown <broonie@kernel.org>
Sun, 11 Feb 2024 16:58:17 +0000 (16:58 +0000)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:10 +0000 (18:19 -0400)
commitd1b6521cecba29bc013162ea7b6f46bab8080656
tree30c839e6545f08be6398306651526f535080624c
parentec33549be99fe25c6927c8b3d6ed13918b27656e
regmap: kunit: Ensure that changed bytes are actually different

[ Upstream commit 2f0dbb24f78a333433a2b875c0b76bf55c119cd4 ]

During the cache sync test we verify that values we expect to have been
written only to the cache do not appear in the hardware. This works most
of the time but since we randomly generate both the original and new values
there is a low probability that these values may actually be the same.
Wrap get_random_bytes() to ensure that the values are different, there
are other tests which should have similar verification that we actually
changed something.

While we're at it refactor the test to use three changed values rather
than attempting to use one of them twice, that just complicates checking
that our new values are actually new.

We use random generation to try to avoid data dependencies in the tests.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://msgid.link/r/20240211-regmap-kunit-random-change-v3-1-e387a9ea4468@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/regmap/regmap-kunit.c