From: Patrick Delaunay Date: Mon, 5 Mar 2018 15:24:34 +0100 Subject: [U-Boot] [PATCH 07/16] stm32mp: stm32f7_i2c: use calloc instead of kmalloc In-Reply-To: <1520259883-4929-1-git-send-email-patrick.delaunay@st.com> References: <1520259883-4929-1-git-send-email-patrick.delaunay@st.com> Message-ID: <1520259883-4929-8-git-send-email-patrick.delaunay@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Kmalloc is using memalign allocation function. It is not necessary to align this structure so to save bytes, we move to calloc. And kmalloc function can't be used in SPL early stage (in board_init_f()) Signed-off-by: Patrick Delaunay --- drivers/i2c/stm32f7_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 8662487..81f061a 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -533,7 +533,7 @@ static int stm32_i2c_compute_solutions(struct stm32_i2c_setup *setup, if (((sdadel >= sdadel_min) && (sdadel <= sdadel_max)) && (p != p_prev)) { - v = kmalloc(sizeof(*v), GFP_KERNEL); + v = calloc(1, sizeof(*v)); if (!v) return -ENOMEM; @@ -689,7 +689,7 @@ exit: /* Release list and memory */ list_for_each_entry_safe(v, _v, &solutions, node) { list_del(&v->node); - kfree(v); + free(v); } return ret; -- 2.7.4