Skip to content

Commit 70a640c

Browse files
geertubroonie
authored andcommitted
regmap: REGMAP_KUNIT should not select REGMAP
Enabling a (modular) test should not silently enable additional kernel functionality, as that may increase the attack vector of a product. Fix this by: 1. making REGMAP visible if CONFIG_KUNIT_ALL_TESTS is enabled, 2. making REGMAP_KUNIT depend on REGMAP instead of selecting it. After this, one can safely enable CONFIG_KUNIT_ALL_TESTS=m to build modules for all appropriate tests for ones system, without pulling in extra unwanted functionality, while still allowing a tester to manually enable REGMAP and its test suite on a system where REGMAP is not enabled by default. Fixes: 2238959 ("regmap: Add some basic kunit tests") Signed-off-by: Geert Uytterhoeven <[email protected] Link: https://lore.kernel.org/r/b0a5dbb17c1d5ea482e052e585ae83bb69c48806.1682516005.git.geert@linux-m68k.org Signed-off-by: Mark Brown <[email protected]
1 parent ac9a786 commit 70a640c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/base/regmap/Kconfig

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@
44
# subsystems should select the appropriate symbols.
55

66
config REGMAP
7+
bool "Register Map support" if KUNIT_ALL_TESTS
78
default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO || REGMAP_FSI)
89
select IRQ_DOMAIN if REGMAP_IRQ
910
select MDIO_BUS if REGMAP_MDIO
10-
bool
11+
help
12+
Enable support for the Register Map (regmap) access API.
13+
14+
Usually, this option is automatically selected when needed.
15+
However, you may want to enable it manually for running the regmap
16+
KUnit tests.
17+
18+
If unsure, say N.
1119

1220
config REGMAP_KUNIT
1321
tristate "KUnit tests for regmap"
14-
depends on KUNIT
22+
depends on KUNIT && REGMAP
1523
default KUNIT_ALL_TESTS
16-
select REGMAP
1724
select REGMAP_RAM
1825

1926
config REGMAP_AC97

0 commit comments

Comments
 (0)