Skip to content

Commit 71a5f1d

Browse files
pdgendtjhedberg
authored andcommitted
include: zephyr: nvmem: Fix _OR macros
Checking if a node has nvmem-cells is not sufficient, we need to check if the idx or name exists. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent feae716 commit 71a5f1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/zephyr/nvmem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ struct nvmem_cell {
182182
* @see NVMEM_CELL_INST_GET_BY_NAME_OR
183183
*/
184184
#define NVMEM_CELL_GET_BY_NAME_OR(node_id, name, default_value) \
185-
COND_CODE_1(DT_NODE_HAS_PROP(node_id, nvmem_cells), \
185+
COND_CODE_1(DT_PROP_HAS_NAME(node_id, nvmem_cells, name), \
186186
(NVMEM_CELL_GET_BY_NAME(node_id, name)), \
187187
(default_value))
188188

@@ -286,7 +286,7 @@ struct nvmem_cell {
286286
* @see NVMEM_CELL_INST_GET_BY_IDX_OR
287287
*/
288288
#define NVMEM_CELL_GET_BY_IDX_OR(node_id, idx, default_value) \
289-
COND_CODE_1(DT_NODE_HAS_PROP(node_id, nvmem_cells), \
289+
COND_CODE_1(DT_PROP_HAS_IDX(node_id, nvmem_cells, idx), \
290290
(NVMEM_CELL_GET_BY_IDX(node_id, idx)), \
291291
(default_value))
292292

0 commit comments

Comments
 (0)