Message ID | 20240209-regmap-kunit-random-change-v2-1-be0a447c2891@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-60036-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1152137dyd; Fri, 9 Feb 2024 13:57:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IE15RDAOK4xeXJQKiP2wvbLzW+llYwmky1p3n67CHGym4G4i6S9T+dV/dRnXE0nA9azJKcc X-Received: by 2002:a05:6a20:3d13:b0:19e:a866:1edd with SMTP id y19-20020a056a203d1300b0019ea8661eddmr523886pzi.33.1707515843495; Fri, 09 Feb 2024 13:57:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707515843; cv=pass; d=google.com; s=arc-20160816; b=HYpoK1IWBunSixbE0N29rYe6X+i9luXsqhXO9qgGSDL30in1xZbKyIFyPxmzR22ihF wOe/603ED7C0+uKcpE9RdV3RTasP7ILPo5l+k/2Y76CInqWl7U+u8chGM728WSXLSYBD lxygqH+ddm8cWeCWTEAllbHlz0Xum82HXHnXB77cT4KcZrI2OH4DOdO1qR64PS5m+y4Z lV/IV8jvf9lx5ePBTKbQQk05vLdPTgOqCMG3OZc8rcTS4cs41HDKseOz13KES+cz89DJ TGqBPVll8e9AX2N05OuIzyVRExH7jh8wJrig7VpLxE2iC5emxSSbNVG6jjtewNDQwlUl GWqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=c9rQxha1MYwHipefS8pq4JhKz7r4amyKhikpHQqJc6A=; fh=js4Ln+dAoHwcI7kr6U6eCBX3oTF3l0JP11eBOqE2gkE=; b=KyGUUEJ589v7x2bBu8tbm+5pqAfPJEt7CX7H01aN+iLvX3TS2M9X0coM/0PJ5ORiQd JKJniOfXjqcxP1/CcL37HBitnB4pgag+6F9BmEfukN9CSWuK3YIBCmI4aPsf+nAVvnk1 TpTvNQm21sJe716Wt/U27TQE0ehxd9HVVbVywm++A/befs7psFiXetkz7EfnFAmWyq5X Qh0ITorux2fbPFV4lyLKmj+Ii3oTDOIuxodJ8jXPYd/4kED/di/Fw3Zq9WSlJmGv+J4/ VZ4kg6l93m6OmMwEdGigcAHbI81wl5ieNkzvCMrWsno9AwHsgOnv7FkKciZ5veFewtjH tJaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TmngzNo5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60036-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60036-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCU3UmUIwLpSqsmDJ+e1X3I28XjHqfIZfsIRfL/wWxcgzwS32Forl5hK6rmBxv0BN/IfNR7BOtllRVsPuKli+8QkU2fO1A== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q5-20020a17090a68c500b0029625680676si2256577pjj.175.2024.02.09.13.57.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 13:57:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60036-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TmngzNo5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60036-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60036-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9FCDAB210F9 for <ouuuleilei@gmail.com>; Fri, 9 Feb 2024 21:34:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85F2420DE3; Fri, 9 Feb 2024 21:33:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TmngzNo5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6A9F17570 for <linux-kernel@vger.kernel.org>; Fri, 9 Feb 2024 21:33:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707514425; cv=none; b=caDmXuC+4/EzRfqzfS3NMUSGPrPCL7ZHUC5hyWqR6XQ3z4Roaslen3JBTeSHs3piUW+rIHduzXBQ6I+hGykF3klW0GXyjVAvNl7J6yy8dzA8fG+hAsSCOGkJkmJUBaf9McjhWE0bWZ+ztdKGXJtbt6gV81o5dpy5xTGmYl5UCCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707514425; c=relaxed/simple; bh=NlXZqaKkhXz9tvOQze70I37khCbmxb0wOBoeUVbkFGg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=jzR1ifCoNfag4iZ6rdic/4tP7kaP4yUQbZixz6Gff+2pPRTIwXTBpXkDtxYDTw4fs4cxQtmCwcTAjBDnN9IPK8DiXB0FjbhB6AqGjvO9qR4BASq9uoyAyoY0j1VzRsCo86obuQ+hefPwZ+UYUzGwcWZcLWIuPugtP455YHE0do0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TmngzNo5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6305EC433F1; Fri, 9 Feb 2024 21:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707514425; bh=NlXZqaKkhXz9tvOQze70I37khCbmxb0wOBoeUVbkFGg=; h=From:Date:Subject:To:Cc:From; b=TmngzNo5wZ0QZDN0n0nxZJxYGyzo/jKf5h8tldRMwbGfxdmkSC9X+xQUKX6pZ/Hrb /ftlLUDFasxuXWh2bGRnoylXNChFGQW4uAobEry6p89vZhzVTlXEpEIqQriKsf/lAn Uphv+vDe3v9mmuzZ4pqqrjjnqqwm6nyKze1dKAkJR3ZnjY7jNp6rZCBqotXWus52Fo h2+Q9YJIw/I8eflcAHUxxiKZbvXCEwU/jq73+beJ27soc/RYKSvhTRtxY2WwMzyIJg HRqYlELVoEU+gwVEgzYD2Co/H9oht+zRx+Kwr797+8lPHK1cgulM35l12OvkfMHinp AbH9rR6PEx5yQ== From: Mark Brown <broonie@kernel.org> Date: Fri, 09 Feb 2024 21:33:32 +0000 Subject: [PATCH v2] regmap: kunit: Ensure that changed bytes are actually different Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240209-regmap-kunit-random-change-v2-1-be0a447c2891@kernel.org> X-B4-Tracking: v=1; b=H4sIACuaxmUC/42NQQ6CMBBFr0Jm7RhaxYIr72FYFDvCBGnJFImGc Hcr8QAu38vP+wtEEqYI52wBoZkjB59A7zK4dda3hOwSg871Mdd5hULtYEfsn54nFOtdGPC3VKZ snKqaSjUFpMAodOfXFr/WiTuOU5D39jWrr/0rOytUaJ125mQKU5SHS0/i6bEP0kK9rusHxJhiY cUAAAA= To: Guenter Roeck <linux@roeck-us.net> Cc: linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org> X-Mailer: b4 0.13-dev-0438c X-Developer-Signature: v=1; a=openpgp-sha256; l=3554; i=broonie@kernel.org; h=from:subject:message-id; bh=NlXZqaKkhXz9tvOQze70I37khCbmxb0wOBoeUVbkFGg=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlxpo37uV6HyHhh/cFp4ovSyuJmtbJ47ESPT3PZ mP6lnnd7dmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZcaaNwAKCRAk1otyXVSH 0O9OB/9TOf/Dgma/o0au9mrFdZIIhmRl0Pqjand++JcpqWRMlbfDVHKAGP2oT2vHxpGsBuYImAn HTI+w/qLT8UBYJOeIqBqtcG+Ic3Mr3gwAdWXdb2e9y7iQAxbTyAo1v/RpcbpvyS8b7R/mmut+b5 PeiZ+lNeMW9dFv9AirjdFZB0g62Hg61SD/dOHRzIJzJypUsyRPnOUTjbGCmlRR3BIdWIVNp+45B CRarnTD6tyF5eTneNnw2NxjcqjzLJHSZ7WHzlLcXP30tH6N92im759xtXbmTsL3NVwm+CMsAlFI 5ONAr2g8LaIIlxaio98PqNtTn5T4bZTKK0DrSpTwHUJFcqGT X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790452933535441930 X-GMAIL-MSGID: 1790460132817623726 |
Series |
[v2] regmap: kunit: Ensure that changed bytes are actually different
|
|
Commit Message
Mark Brown
Feb. 9, 2024, 9:33 p.m. UTC
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, it is
likely we will want a similar pattern for other tests in the future.
We use random generation to try to avoid data dependencies in the tests.
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
Changes in v2:
- Check the whole change in.
- Link to v1: https://lore.kernel.org/r/20240209-regmap-kunit-random-change-v1-1-ad2d76757583@kernel.org
---
drivers/base/regmap/regmap-kunit.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
---
base-commit: 3b201c9af7c0cad2e8311d96c0c1b399606c70fa
change-id: 20240209-regmap-kunit-random-change-178bd19b91b5
Best regards,
Comments
Hi Mark, On 2/9/24 13:33, Mark Brown wrote: > 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, it is > likely we will want a similar pattern for other tests in the future. > > We use random generation to try to avoid data dependencies in the tests. > > Reported-by: Guenter Roeck <linux@roeck-us.net> > Signed-off-by: Mark Brown <broonie@kernel.org> This is actually worse than v1 because hw_buf[6] isn't used anywhere. Making sure that the values in the val[] array don't match the values in hw_buf[6..7] doesn't add any value. With this change, and the patch below applied on top of it: # raw_sync: EXPECTATION FAILED at drivers/base/regmap/regmap-kunit.c:1329 Expected &hw_buf[2] != val, but &hw_buf[2] == fb 16 cf 93 val == fb 16 cf 93 # raw_sync: EXPECTATION FAILED at drivers/base/regmap/regmap-kunit.c:1330 Expected &hw_buf[4] != val, but &hw_buf[4] == fb 16 val == fb 16 not ok 1 flat-little # raw_sync: EXPECTATION FAILED at drivers/base/regmap/regmap-kunit.c:1329 [ lots of those ] FWIW, I had struggled with the re-use of val[0] for two different tests (on hw_buf[2] and hw_buf[4]) myself. The only solution other than making sure that it neither matches hw_buf[2] nor hw_buf[4] I came up with was to use a separate variable for the accesses to hw_buf[4] (or hw_buf[6] in the old code). Something like the second patch below, applied on top of your v2. Guenter --- diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c index 85e02f86b14c..67cc3239f478 100644 --- a/drivers/base/regmap/regmap-kunit.c +++ b/drivers/base/regmap/regmap-kunit.c @@ -1284,6 +1284,14 @@ static void raw_sync(struct kunit *test) hw_buf = (u16 *)data->vals; get_changed_bytes(&hw_buf[6], &val[0], sizeof(val)); + // Let's cheat. + // Remember, the above code doesn't look into hw_buf[2..5], + // so anything might be in there, including the values from + // the val[] array. + hw_buf[2] = val[0]; + hw_buf[3] = val[1]; + hw_buf[4] = val[0]; + hw_buf[5] = val[1]; /* Do a regular write and a raw write in cache only mode */ regcache_cache_only(map, true); --- diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c index 85e02f86b14c..d2cf510f86f0 100644 --- a/drivers/base/regmap/regmap-kunit.c +++ b/drivers/base/regmap/regmap-kunit.c @@ -1269,7 +1269,7 @@ static void raw_sync(struct kunit *test) struct regmap *map; struct regmap_config config; struct regmap_ram_data *data; - u16 val[2]; + u16 val[3]; u16 *hw_buf; unsigned int rval; int i; @@ -1283,17 +1283,17 @@ static void raw_sync(struct kunit *test) hw_buf = (u16 *)data->vals; - get_changed_bytes(&hw_buf[6], &val[0], sizeof(val)); + get_changed_bytes(&hw_buf[2], &val[0], sizeof(val)); /* Do a regular write and a raw write in cache only mode */ regcache_cache_only(map, true); - KUNIT_EXPECT_EQ(test, 0, regmap_raw_write(map, 2, val, sizeof(val))); + KUNIT_EXPECT_EQ(test, 0, regmap_raw_write(map, 2, val, sizeof(u16) * 2)); if (config.val_format_endian == REGMAP_ENDIAN_BIG) KUNIT_EXPECT_EQ(test, 0, regmap_write(map, 4, - be16_to_cpu(val[0]))); + be16_to_cpu(val[2]))); else KUNIT_EXPECT_EQ(test, 0, regmap_write(map, 4, - le16_to_cpu(val[0]))); + le16_to_cpu(val[2]))); /* We should read back the new values, and defaults for the rest */ for (i = 0; i < config.max_register + 1; i++) { @@ -1305,10 +1305,10 @@ static void raw_sync(struct kunit *test) case 4: if (config.val_format_endian == REGMAP_ENDIAN_BIG) { KUNIT_EXPECT_EQ(test, rval, - be16_to_cpu(val[i % 2])); + be16_to_cpu(val[i - 2])); } else { KUNIT_EXPECT_EQ(test, rval, - le16_to_cpu(val[i % 2])); + le16_to_cpu(val[i - 2])); } break; default: @@ -1318,8 +1318,8 @@ static void raw_sync(struct kunit *test) } /* The values should not appear in the "hardware" */ - KUNIT_EXPECT_MEMNEQ(test, &hw_buf[2], val, sizeof(val)); - KUNIT_EXPECT_MEMNEQ(test, &hw_buf[4], val, sizeof(u16)); + KUNIT_EXPECT_MEMNEQ(test, &hw_buf[2], val, sizeof(u16) * 2); + KUNIT_EXPECT_MEMNEQ(test, &hw_buf[4], &val[2], sizeof(u16)); for (i = 0; i < config.max_register + 1; i++) data->written[i] = false; @@ -1331,7 +1331,6 @@ static void raw_sync(struct kunit *test) /* The values should now appear in the "hardware" */ KUNIT_EXPECT_MEMEQ(test, &hw_buf[2], val, sizeof(val)); - KUNIT_EXPECT_MEMEQ(test, &hw_buf[4], val, sizeof(u16)); regmap_exit(map); }
On Fri, Feb 09, 2024 at 02:07:38PM -0800, Guenter Roeck wrote: > This is actually worse than v1 because hw_buf[6] isn't used anywhere. > Making sure that the values in the val[] array don't match the values > in hw_buf[6..7] doesn't add any value. Yeah, I realised after reading your earlier mail. It's passing for me somehow. > FWIW, I had struggled with the re-use of val[0] for two different tests > (on hw_buf[2] and hw_buf[4]) myself. The only solution other than making sure > that it neither matches hw_buf[2] nor hw_buf[4] I came up with was to use a > separate variable for the accesses to hw_buf[4] (or hw_buf[6] in the old code). Indeed, it was fine with the old code due to not caring about having different values but we need to generate three values now. > get_changed_bytes(&hw_buf[6], &val[0], sizeof(val)); > + // Let's cheat. > + // Remember, the above code doesn't look into hw_buf[2..5], > + // so anything might be in there, including the values from > + // the val[] array. > + hw_buf[2] = val[0]; > + hw_buf[3] = val[1]; > + hw_buf[4] = val[0]; > + hw_buf[5] = val[1]; I don't understand how this interacts with the pre-sync check?
On 2/9/24 14:39, Mark Brown wrote: > On Fri, Feb 09, 2024 at 02:07:38PM -0800, Guenter Roeck wrote: > >> This is actually worse than v1 because hw_buf[6] isn't used anywhere. >> Making sure that the values in the val[] array don't match the values >> in hw_buf[6..7] doesn't add any value. > > Yeah, I realised after reading your earlier mail. It's passing for me > somehow. > It is passing because the probability for it to fail is really low. It only fails reliably with the cheat below. >> FWIW, I had struggled with the re-use of val[0] for two different tests >> (on hw_buf[2] and hw_buf[4]) myself. The only solution other than making sure >> that it neither matches hw_buf[2] nor hw_buf[4] I came up with was to use a >> separate variable for the accesses to hw_buf[4] (or hw_buf[6] in the old code). > Indeed, it was fine with the old code due to not caring about having > different values but we need to generate three values now. > >> get_changed_bytes(&hw_buf[6], &val[0], sizeof(val)); >> + // Let's cheat. >> + // Remember, the above code doesn't look into hw_buf[2..5], >> + // so anything might be in there, including the values from >> + // the val[] array. >> + hw_buf[2] = val[0]; >> + hw_buf[3] = val[1]; >> + hw_buf[4] = val[0]; >> + hw_buf[5] = val[1]; > > I don't understand how this interacts with the pre-sync check? That is because the test expects the memory in hw_buf[] and val[] to be different (because hw_buf[] wasn't updated to the new values). The above cheat forces hw_buf[2,3] and val[0,1] to be the same, so the pre-sync test fails. The post-sync test passes because the values are expected to be the same at that time. Guenter
On Fri, Feb 09, 2024 at 03:20:40PM -0800, Guenter Roeck wrote: > On 2/9/24 14:39, Mark Brown wrote: > > > + // so anything might be in there, including the values from > > > + // the val[] array. > > > + hw_buf[2] = val[0]; > > > + hw_buf[3] = val[1]; > > > + hw_buf[4] = val[0]; > > > + hw_buf[5] = val[1]; > > I don't understand how this interacts with the pre-sync check? > That is because the test expects the memory in hw_buf[] and val[] to be > different (because hw_buf[] wasn't updated to the new values). The above > cheat forces hw_buf[2,3] and val[0,1] to be the same, so the pre-sync test > fails. The post-sync test passes because the values are expected to be > the same at that time. Ah, that was my read - I was thinking I was missing some way for both tests to pass.
diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c index 026bdcb45127..e149b12d0d4a 100644 --- a/drivers/base/regmap/regmap-kunit.c +++ b/drivers/base/regmap/regmap-kunit.c @@ -9,6 +9,23 @@ #define BLOCK_TEST_SIZE 12 +static void get_changed_bytes(void *orig, void *new, size_t size) +{ + char *o = orig; + char *n = new; + int i; + + get_random_bytes(new, size); + + /* + * This could be nicer and more efficient but we shouldn't + * super care. + */ + for (i = 0; i < size; i++) + while (n[i] == o[i]) + get_random_bytes(&n[i], 1); +} + static const struct regmap_config test_regmap_config = { .max_register = BLOCK_TEST_SIZE, .reg_stride = 1, @@ -1265,16 +1282,16 @@ static void raw_sync(struct kunit *test) hw_buf = (u16 *)data->vals; - get_random_bytes(&val, sizeof(val)); + get_changed_bytes(&hw_buf[6], &val[0], sizeof(val)); /* Do a regular write and a raw write in cache only mode */ regcache_cache_only(map, true); KUNIT_EXPECT_EQ(test, 0, regmap_raw_write(map, 2, val, sizeof(val))); if (config.val_format_endian == REGMAP_ENDIAN_BIG) - KUNIT_EXPECT_EQ(test, 0, regmap_write(map, 6, + KUNIT_EXPECT_EQ(test, 0, regmap_write(map, 4, be16_to_cpu(val[0]))); else - KUNIT_EXPECT_EQ(test, 0, regmap_write(map, 6, + KUNIT_EXPECT_EQ(test, 0, regmap_write(map, 4, le16_to_cpu(val[0]))); /* We should read back the new values, and defaults for the rest */ @@ -1284,7 +1301,7 @@ static void raw_sync(struct kunit *test) switch (i) { case 2: case 3: - case 6: + case 4: if (config.val_format_endian == REGMAP_ENDIAN_BIG) { KUNIT_EXPECT_EQ(test, rval, be16_to_cpu(val[i % 2])); @@ -1301,7 +1318,7 @@ static void raw_sync(struct kunit *test) /* The values should not appear in the "hardware" */ KUNIT_EXPECT_MEMNEQ(test, &hw_buf[2], val, sizeof(val)); - KUNIT_EXPECT_MEMNEQ(test, &hw_buf[6], val, sizeof(u16)); + KUNIT_EXPECT_MEMNEQ(test, &hw_buf[4], val, sizeof(u16)); for (i = 0; i < config.max_register + 1; i++) data->written[i] = false; @@ -1313,7 +1330,7 @@ static void raw_sync(struct kunit *test) /* The values should now appear in the "hardware" */ KUNIT_EXPECT_MEMEQ(test, &hw_buf[2], val, sizeof(val)); - KUNIT_EXPECT_MEMEQ(test, &hw_buf[6], val, sizeof(u16)); + KUNIT_EXPECT_MEMEQ(test, &hw_buf[4], val, sizeof(u16)); regmap_exit(map); }