summaryrefslogtreecommitdiff
path: root/lib/hashtable.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-07-02 09:53:34 -0400
committerTom Rini <trini@konsulko.com>2020-07-02 09:53:34 -0400
commit785195941b0746ac987a0ca501dae3e570b9f042 (patch)
tree317f4d937fb80de27123a1d18adc29ad5bf9337c /lib/hashtable.c
parente2a4d24e6b1f3d30136e2dde7b6fbf35bd427b8a (diff)
parentadd0dc1f7de91112d9e738f9482b09b75fa86acb (diff)
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into next
- Add Sipeed Maix support - Update clock handler and proper cpu features
Diffstat (limited to 'lib/hashtable.c')
-rw-r--r--lib/hashtable.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/hashtable.c b/lib/hashtable.c
index b96dbe19be4..7b6781bc354 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -110,8 +110,10 @@ int hcreate_r(size_t nel, struct hsearch_data *htab)
}
/* There is still another table active. Return with error. */
- if (htab->table != NULL)
+ if (htab->table != NULL) {
+ __set_errno(EINVAL);
return 0;
+ }
/* Change nel to the first prime number not smaller as nel. */
nel |= 1; /* make odd */
@@ -124,8 +126,10 @@ int hcreate_r(size_t nel, struct hsearch_data *htab)
/* allocate memory and zero out */
htab->table = (struct env_entry_node *)calloc(htab->size + 1,
sizeof(struct env_entry_node));
- if (htab->table == NULL)
+ if (htab->table == NULL) {
+ __set_errno(ENOMEM);
return 0;
+ }
/* everything went alright */
return 1;