From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 24 Sep 2012 01:11:57 +0200 Subject: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added. In-Reply-To: <1348416940-20319-1-git-send-email-tmshlvck@gmail.com> References: <1346069529-27397-1-git-send-email-tmshlvck@gmail.com> <1348416940-20319-1-git-send-email-tmshlvck@gmail.com> Message-ID: <201209240111.57287.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Tomas Hlavacek, [..] > + > + if (early_malloc_active()) { > + addr = early_malloc(size); > + for (i=0; i + addr[i] = 0; memset() ? > + > + return addr; > + } > +#endif /* CONFIG_SYS_EARLY_MALLOC */ > + return calloc(n, elem_size); > +} > + > +static inline void *dmrealloc(void *oldmem, size_t bytes) > +{ > +#ifdef CONFIG_SYS_EARLY_MALLOC > + if (early_malloc_active()) > + return NULL; I wonder how should this be implemented ... maybe early_malloc + standard memcpy() > +#endif /* CONFIG_SYS_EARLY_MALLOC */ > + return dmrealloc(oldmem, bytes); > +} > + > +#endif /* CONFIG_DM */ > +#endif /* __INCLUDE_DMMALLOC_H */ > + Best regards, Marek Vasut