Skip to content

Commit 7011b51

Browse files
lopsided98broonie
authored andcommitted
regmap: kunit: fix raw noinc write test wrapping
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 <[email protected]> Reported-by: Guenter Roeck <[email protected]> Closes: https://lore.kernel.org/linux-kernel/[email protected]/T/ Tested-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 54be6c6 commit 7011b51

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/base/regmap/regmap-kunit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,8 @@ static void raw_noinc_write(struct kunit *test)
12021202
struct regmap *map;
12031203
struct regmap_config config;
12041204
struct regmap_ram_data *data;
1205-
unsigned int val, val_test, val_last;
1205+
unsigned int val;
1206+
u16 val_test, val_last;
12061207
u16 val_array[BLOCK_TEST_SIZE];
12071208

12081209
config = raw_regmap_config;

0 commit comments

Comments
 (0)