[PATCH v6 3/8] common: elf: use calloc instead of xzalloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This failure can be handled grecefully, use standard calloc.

Signed-off-by: Clement Leger <cleger@xxxxxxxxx>
---
 common/elf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/elf.c b/common/elf.c
index 55f5bc645..0e92661e1 100644
--- a/common/elf.c
+++ b/common/elf.c
@@ -19,7 +19,10 @@ static int elf_request_region(struct elf_image *elf, resource_size_t start,
 	struct resource *r_new;
 	struct elf_section *r;
 
-	r = xzalloc(sizeof(*r));
+	r = calloc(1, sizeof(*r));
+	if (!r)
+		return -ENOMEM;
+
 	r_new = request_sdram_region("elf_section", start, size);
 	if (!r_new) {
 		pr_err("Failed to request region: %pa %pa\n", &start, &size);
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux