[PATCH] core: devres: don't use devres code when CONFIG_DEVRES is not defined

Angus Ainslie angus at akkea.ca
Thu Feb 3 00:16:36 CET 2022


Put guards around the devres code so that it isn't compiled during the SPL.

Signed-off-by: Angus Ainslie <angus at akkea.ca>
---
 drivers/core/devres.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/core/devres.c b/drivers/core/devres.c
index 313ddc7089..92a237c64c 100644
--- a/drivers/core/devres.c
+++ b/drivers/core/devres.c
@@ -91,6 +91,7 @@ void *_devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
 	return dr->data;
 }
 
+#if CONFIG_DEVRES
 void devres_free(void *res)
 {
 	if (res) {
@@ -257,7 +258,7 @@ void devres_get_stats(const struct udevice *dev, struct devres_stats *stats)
 	}
 }
 
-#endif
+#endif /* CONFIG_DEBUG_DEVRES */
 
 /*
  * Managed kmalloc/kfree
@@ -292,3 +293,4 @@ void devm_kfree(struct udevice *dev, void *p)
 	rc = devres_destroy(dev, devm_kmalloc_release, devm_kmalloc_match, p);
 	assert_noisy(!rc);
 }
+#endif /* CONFIG_DEVRES */
-- 
2.25.1



More information about the U-Boot mailing list