Skip to content

Commit 81e1d9a

Browse files
miquelraynalgregkh
authored andcommitted
nvmem: core: Return NULL when no nvmem layout is found
Currently, of_nvmem_layout_get_container() returns NULL on error, or an error pointer if either CONFIG_NVMEM or CONFIG_OF is turned off. We should likely avoid this kind of mix for two reasons: to clarify the intend and anyway fix the !CONFIG_OF which will likely always if we use this helper somewhere else. Let's just return NULL when no layout is found, we don't need an error value here. Link: https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/ Fixes: 266570f ("nvmem: core: introduce NVMEM layouts") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Michael Walle <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f4d1d17 commit 81e1d9a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/nvmem-consumer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static inline struct nvmem_device *of_nvmem_device_get(struct device_node *np,
256256
static inline struct device_node *
257257
of_nvmem_layout_get_container(struct nvmem_device *nvmem)
258258
{
259-
return ERR_PTR(-EOPNOTSUPP);
259+
return NULL;
260260
}
261261
#endif /* CONFIG_NVMEM && CONFIG_OF */
262262

0 commit comments

Comments
 (0)