Skip to content

Commit 80a99fa

Browse files
nvlsianpucarlescufi
authored andcommitted
subsys: storage: flash_map: enable only if any flash driver is enable
It was possible to have enable flash module while no flash driver implementation was enabled. This cause coverity issues and unnecessary initialization call. This pat introduce FLASH_HAS_DRIVER_ENABLED Kconfig keyword which is selected once any flash driver is enabled. flash_map switch its dependency to this keyword. Signed-off-by: Andrzej Puzdrowski <[email protected]>
1 parent 51527e0 commit 80a99fa

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

drivers/flash/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
#
1010
# Flash driver
1111
#
12+
config FLASH_HAS_DRIVER_ENABLED
13+
bool
14+
default n
15+
help
16+
This option is enabled when any flash driver is enabled.
17+
1218
menuconfig FLASH
1319
bool
1420
prompt "Flash hardware support"
@@ -26,6 +32,7 @@ config FLASH_PAGE_LAYOUT
2632
config SPI_FLASH_W25QXXDV
2733
bool
2834
prompt "SPI NOR Flash Winbond W25QXXDV"
35+
select FLASH_HAS_DRIVER_ENABLED
2936
depends on SPI && FLASH
3037

3138
config SPI_FLASH_W25QXXDV_SPI_NAME
@@ -84,6 +91,7 @@ config SOC_FLASH_QMSI
8491
bool
8592
prompt "QMSI flash driver"
8693
depends on QMSI && FLASH
94+
select FLASH_HAS_DRIVER_ENABLED
8795
default n
8896
help
8997
Enable QMSI Quark flash driver.
@@ -128,6 +136,7 @@ config SOC_FLASH_NRF5
128136
depends on FLASH && SOC_FAMILY_NRF5
129137
default n
130138
select FLASH_HAS_PAGE_LAYOUT
139+
select FLASH_HAS_DRIVER_ENABLED
131140
help
132141
Enables Nordic Semiconductor nRF5X flash driver.
133142

@@ -142,6 +151,7 @@ config SOC_FLASH_MCUX
142151
bool "MCUX flash shim driver"
143152
depends on FLASH && HAS_MCUX
144153
select FLASH_HAS_PAGE_LAYOUT
154+
select FLASH_HAS_DRIVER_ENABLED
145155
default n
146156
help
147157
Enables the MCUX flash shim driver.
@@ -154,6 +164,7 @@ config SOC_FLASH_NIOS2_QSPI
154164
bool "Nios-II QSPI flash driver"
155165
depends on FLASH && HAS_ALTERA_HAL
156166
default n
167+
select FLASH_HAS_DRIVER_ENABLED
157168
help
158169
Enables the Nios-II QSPI flash driver.
159170

drivers/flash/Kconfig.sam0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ menuconfig SOC_FLASH_SAM0
1010
prompt "Atmel SAM0 flash driver"
1111
default n
1212
select FLASH_HAS_PAGE_LAYOUT
13+
select FLASH_HAS_DRIVER_ENABLED
1314
help
1415
Enable the Atmel SAM0 series internal flash driver.
1516

drivers/flash/Kconfig.stm32

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ menuconfig SOC_FLASH_STM32
1212
bool
1313
prompt "STM32 flash driver"
1414
depends on (SOC_SERIES_STM32F0X || SOC_SERIES_STM32F3X || SOC_SERIES_STM32F4X || SOC_SERIES_STM32L4X)
15+
select FLASH_HAS_DRIVER_ENABLED
1516
default y
1617
select FLASH_PAGE_LAYOUT if SOC_SERIES_STM32F0X
1718
select FLASH_PAGE_LAYOUT if SOC_SERIES_STM32F4X

subsys/storage/flash_map/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ menuconfig FLASH_MAP
1313
bool
1414
prompt "Flash map abstraction module"
1515
default n
16-
depends on FLASH
16+
depends on FLASH_HAS_DRIVER_ENABLED
1717
help
1818
Enable support of flash map abstraction.
1919

0 commit comments

Comments
 (0)