From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from zimbra2.kalray.eu ([92.103.151.219]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjdqx-000694-Lm for barebox@lists.infradead.org; Fri, 12 Jun 2020 07:11:53 +0000 From: Clement Leger Date: Fri, 12 Jun 2020 09:10:31 +0200 Message-Id: <20200612071036.27864-4-cleger@kalray.eu> In-Reply-To: <20200612071036.27864-1-cleger@kalray.eu> References: <20200612071036.27864-1-cleger@kalray.eu> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v6 3/8] common: elf: use calloc instead of xzalloc To: Sascha Hauer , barebox@lists.infradead.org Cc: Clement Leger , Oleksij Rempel This failure can be handled grecefully, use standard calloc. Signed-off-by: Clement Leger --- 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@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox