drivers/base/regmap/regmap-kunit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
The raw noinc write test places a known value in the register following
the noinc register to verify that it is not disturbed by the noinc
write. This test ensures this value is distinct by adding 100 to the
second element of the noinc write data.
The regmap registers are 16-bit, while the test value is stored in an
unsigned int. Therefore, adding 100 may cause the register to wrap while
the test value does not, causing the test to fail. This patch fixes this
by changing val_test and val_last from unsigned int to u16.
Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/linux-kernel/745d3a11-15bc-48b6-84c8-c8761c943bed@roeck-us.net/T/
---
drivers/base/regmap/regmap-kunit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c
index 026bdcb45127..4eb18f5d3265 100644
--- a/drivers/base/regmap/regmap-kunit.c
+++ b/drivers/base/regmap/regmap-kunit.c
@@ -1202,7 +1202,8 @@ static void raw_noinc_write(struct kunit *test)
struct regmap *map;
struct regmap_config config;
struct regmap_ram_data *data;
- unsigned int val, val_test, val_last;
+ unsigned int val;
+ u16 val_test, val_last;
u16 val_array[BLOCK_TEST_SIZE];
config = raw_regmap_config;
--
2.43.0
On Tue, 06 Feb 2024 10:10:05 -0500, Ben Wolsieffer wrote:
> The raw noinc write test places a known value in the register following
> the noinc register to verify that it is not disturbed by the noinc
> write. This test ensures this value is distinct by adding 100 to the
> second element of the noinc write data.
>
> The regmap registers are 16-bit, while the test value is stored in an
> unsigned int. Therefore, adding 100 may cause the register to wrap while
> the test value does not, causing the test to fail. This patch fixes this
> by changing val_test and val_last from unsigned int to u16.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap: kunit: fix raw noinc write test wrapping
commit: 7011b51f13b391ee06708bb1f82653a2953f8cfc
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
On 2/6/24 07:10, Ben Wolsieffer wrote: > The raw noinc write test places a known value in the register following > the noinc register to verify that it is not disturbed by the noinc > write. This test ensures this value is distinct by adding 100 to the > second element of the noinc write data. > > The regmap registers are 16-bit, while the test value is stored in an > unsigned int. Therefore, adding 100 may cause the register to wrap while > the test value does not, causing the test to fail. This patch fixes this > by changing val_test and val_last from unsigned int to u16. > > Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com> > Reported-by: Guenter Roeck <linux@roeck-us.net> > Closes: https://lore.kernel.org/linux-kernel/745d3a11-15bc-48b6-84c8-c8761c943bed@roeck-us.net/T/ I no longer see the problem with this patch applied. Tested-by: Guenter Roeck <linux@roeck-us.net> Thanks, Guenter
On Tue, Feb 06, 2024 at 10:10:05AM -0500, Ben Wolsieffer wrote: > The raw noinc write test places a known value in the register following > the noinc register to verify that it is not disturbed by the noinc > write. This test ensures this value is distinct by adding 100 to the > second element of the noinc write data. > > The regmap registers are 16-bit, while the test value is stored in an > unsigned int. Therefore, adding 100 may cause the register to wrap while > the test value does not, causing the test to fail. This patch fixes this > by changing val_test and val_last from unsigned int to u16. Ah, that'd do it! I wonder why Guenter is seeing this with much greater frequency than I am, I have managed to reproduce a few times this afternoon but very rarely. Guenter, does this fix the issues you're seeing?
On 2/6/24 07:38, Mark Brown wrote: > On Tue, Feb 06, 2024 at 10:10:05AM -0500, Ben Wolsieffer wrote: >> The raw noinc write test places a known value in the register following >> the noinc register to verify that it is not disturbed by the noinc >> write. This test ensures this value is distinct by adding 100 to the >> second element of the noinc write data. >> >> The regmap registers are 16-bit, while the test value is stored in an >> unsigned int. Therefore, adding 100 may cause the register to wrap while >> the test value does not, causing the test to fail. This patch fixes this >> by changing val_test and val_last from unsigned int to u16. > > Ah, that'd do it! I wonder why Guenter is seeing this with much greater > frequency than I am, I have managed to reproduce a few times this > afternoon but very rarely. Guenter, does this fix the issues you're > seeing? Give me a bit. It takes ~2 hours for a complete test run. I am not surprised that you didn't see the problem easily. I am running more than 500 boot tests on each release, and only saw it in four of them when testing v6.8-rc3. So I'd expect a "hit" rate of about 1%. Thanks, Guenter
On Tue, Feb 06, 2024 at 08:43:31AM -0800, Guenter Roeck wrote: > On 2/6/24 07:38, Mark Brown wrote: > > Ah, that'd do it! I wonder why Guenter is seeing this with much greater > > frequency than I am, I have managed to reproduce a few times this > > afternoon but very rarely. Guenter, does this fix the issues you're > > seeing? > Give me a bit. It takes ~2 hours for a complete test run. No problem. > I am not surprised that you didn't see the problem easily. I am running > more than 500 boot tests on each release, and only saw it in four of them > when testing v6.8-rc3. So I'd expect a "hit" rate of about 1%. Ah, that does sound like about the rate I was seeing issues at. I hadn't realised how many of these tests you run.
© 2016 - 2026 Red Hat, Inc.