<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/base/regmap/regmap-kunit.c, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-08-14T13:34:05Z</updated>
<entry>
<title>regmap: kunit: Fix memory leaks in gen_regmap() and gen_raw_regmap()</title>
<updated>2024-08-14T13:34:05Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-11T10:37:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9a3f1490f9b2b7b4d484d032dd0f13296ad59e08'/>
<id>urn:sha1:9a3f1490f9b2b7b4d484d032dd0f13296ad59e08</id>
<content type='text'>
[ Upstream commit c3820641da87442251e0c00b6874ef1022da8f58 ]

- Use kunit_kcalloc() to allocate the defaults table so that it will be
  freed when the test case ends.
- kfree() the buf and *data buffers on the error paths.
- Use kunit_add_action_or_reset() instead of kunit_add_action() so that
  if it fails it will call regmap_exit().

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240411103724.54063-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Fix array overflow in stride() test</title>
<updated>2024-05-17T17:23:12Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-05-17T14:47:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7ba822189e6060a8a2833b721d430f833bf0db43'/>
<id>urn:sha1:7ba822189e6060a8a2833b721d430f833bf0db43</id>
<content type='text'>
Force the max_register of the test regmap to be one register longer
than the number of test registers, to prevent an array overflow in
the test loop.

The test defines num_reg_defaults = 6. With 6 registers and
stride == 2 the valid register addresses would be 0, 2, 4, 6, 8, 10.
However the loop checks attempting to access the odd address, so on
the final register it accesses address 11, and it writes entry [11]
of the read/written arrays.

Originally this worked because the max_register of the regmap was
hardcoded to be BLOCK_TEST_SIZE (== 12).

commit 710915743d53 ("regmap: kunit: Run sparse cache tests at non-zero
register addresses")
introduced the ability to start the test address range from any address,
which means adjusting the max_register. If max_register was not forced,
it was calculated either from num_reg_defaults or BLOCK_TEST_SIZE. This
correctly calculated that with num_reg_defaults == 6 and stride == 2 the
final valid address is 10. So the read/written arrays are allocated to
contain entries [0..10]. When stride attempted to access [11] it was
overflowing the array.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Fixes: 710915743d53 ("regmap: kunit: Run sparse cache tests at non-zero register addresses")
Tested-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://msgid.link/r/20240517144703.1200995-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Fix an NULL vs IS_ERR() check</title>
<updated>2024-04-15T10:54:57Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2024-04-15T10:34:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=991b5e2aad870828669ca105f424ef1b2534f820'/>
<id>urn:sha1:991b5e2aad870828669ca105f424ef1b2534f820</id>
<content type='text'>
The kunit_device_register() function returns error pointers, not NULL.
Passing an error pointer to get_device() will lead to an Oops.  Also
get_device() returns the same device you passed to it.  Fix it!  ;)

Fixes: 7b7982f14315 ("regmap: kunit: Create a struct device for the regmap")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Link: https://lore.kernel.org/r/b32e80cf-b385-40cd-b8ec-77ec73e07530@moroto.mountain
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Add test cases for regmap_read_bypassed()</title>
<updated>2024-04-08T15:38:15Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-08T14:46:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f63eb9ae085dc6da27eebfe35317e07a6a02a160'/>
<id>urn:sha1:f63eb9ae085dc6da27eebfe35317e07a6a02a160</id>
<content type='text'>
This adds test cases to prove that regmap_read_bypassed() reads
the hardware value while the regmap is in cache-only.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240408144600.230848-12-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Add cache-drop test with multiple cache blocks</title>
<updated>2024-04-08T15:38:14Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-08T14:45:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=468d277e6fb112e7a5e816ef5f1f6bd86c29bea6'/>
<id>urn:sha1:468d277e6fb112e7a5e816ef5f1f6bd86c29bea6</id>
<content type='text'>
Add a test case for dropping only some cache blocks and leaving others
unchanged.

The regmap is divided into 8 register ranges, and only 4 of these are
written with values. This creates 4 non-contiguous ranges of registers
with cached values.

One whole range is then dropped, and part of another range. A cache
sync is then performed to check that the correct registers were written,
and the correct values were written to these registers.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240408144600.230848-11-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Replace a kmalloc/kfree() pair with KUnit-managed alloc</title>
<updated>2024-04-08T15:38:13Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-08T14:45:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d6f2fd7adcb5f25ac661808be9409f846b1de6fe'/>
<id>urn:sha1:d6f2fd7adcb5f25ac661808be9409f846b1de6fe</id>
<content type='text'>
Replace the kmalloc() and kfree() in raw_read_defaults() with a
kunit_kmalloc() so that KUnit will free it automatically.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240408144600.230848-10-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Use a KUnit action to call regmap_exit()</title>
<updated>2024-04-08T15:38:12Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-08T14:45:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ce75e06eea9cfdddaa0082cef663cf2d4aa5ed1d'/>
<id>urn:sha1:ce75e06eea9cfdddaa0082cef663cf2d4aa5ed1d</id>
<content type='text'>
Registert a KUnit action handler to call regmap_exit() when a test
terminates. This ensures that regmap_exit() will be called if a test
function returns early or aborts.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240408144600.230848-9-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Add more cache-sync tests</title>
<updated>2024-04-08T15:38:11Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-08T14:45:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7903d15f008056c8c152f2aa3b36217917853264'/>
<id>urn:sha1:7903d15f008056c8c152f2aa3b36217917853264</id>
<content type='text'>
Extend the testing of cache-sync.

- cache_sync() renamed cache_sync_marked_dirty() for clarity of
  what conditions it is testing.

- cache_sync_defaults() renamed cache_sync_defaults_marked_dirty()
  for clarity. Added code to write the register back to its default
  value to check that a dirty sync doesn't write out the default value.

- Added cache_sync_after_cache_only(). Tests syncing the cache without
  calling regcache_mark_dirty(). A register written while in cache-only
  should be written out by regcache_sync().

- Added cache_sync_default_after_cache_only. This is similar to
  cache_sync_after_cache_only(), but the register is changed to its
  default value while in cache-only. Because regcache_mark_dirty() was
  NOT called, regacache_sync() should write out the register.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240408144600.230848-8-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Add more cache-drop tests</title>
<updated>2024-04-08T15:38:10Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-08T14:45:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7dd52d301cfcff9a67be19d00289e03d80d05e46'/>
<id>urn:sha1:7dd52d301cfcff9a67be19d00289e03d80d05e46</id>
<content type='text'>
Extend the testing of cache-drop.

- Added cache_drop_all_and_sync_marked_dirty(). If all registers are
  dropped from the cache a regcache_mark_dirty() followed by
  regcache_sync() should not write anything because the cache is empty.

- Added cache_drop_all_and_sync_no_defaults(). This is similar to
  cache_drop_all_and_sync_marked_dirty() except that regcache_mark_dirty()
  is NOT called. All registers were dropped so regcache_sync() should not
  write anything.

- Added cache_drop_all_and_sync_has_defaults(). This is the same as
  cache_drop_all_and_sync_no_defaults() except that the regmap has a
  table of default values.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240408144600.230848-7-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: kunit: Run non-sparse cache tests at non-zero register addresses</title>
<updated>2024-04-08T15:38:09Z</updated>
<author>
<name>Richard Fitzgerald</name>
</author>
<published>2024-04-08T14:45:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ac4394bf9c5e065919a0e491bfd95e2106b1b9b2'/>
<id>urn:sha1:ac4394bf9c5e065919a0e491bfd95e2106b1b9b2</id>
<content type='text'>
Change the tests parameterized by real_cache_types_list[] to test at some
register addresses that are not 0.

The cache_range_window_reg() test has hardcoded address assumptions that
are not present in any other tests using real_cache_types_list[] table. So
it has been given a separate parameter table, real_cache_types_only_list[],
that preserves the original parameterization.

Signed-off-by: Richard Fitzgerald &lt;rf@opensource.cirrus.com&gt;
Link: https://msgid.link/r/20240408144600.230848-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
</feed>
