summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2018-03-12 10:46:09 +0100
committerTom Rini <trini@konsulko.com>2018-03-19 16:14:21 -0400
commit35746c0138c7a9900fb2678358904c10797a563a (patch)
tree12bead072fe275ace1e824e89f8d244e4fb1bf12
parentf11c308ac20eb14eb7ce0c4a25987cb5462e017c (diff)
downloadu-boot-35746c0138c7a9900fb2678358904c10797a563a.tar.gz
u-boot-35746c0138c7a9900fb2678358904c10797a563a.tar.xz
u-boot-35746c0138c7a9900fb2678358904c10797a563a.zip
stm32mp: stm32f7_i2c: use calloc instead of kmalloc
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 <patrick.delaunay@st.com>
-rw-r--r--drivers/i2c/stm32f7_i2c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c
index 86624878e2..81f061aecd 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;