aboutsummaryrefslogtreecommitdiff
path: root/libflash/libffs.c
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2018-03-15 16:58:17 +1100
committerStewart Smith <stewart@linux.ibm.com>2018-04-09 03:45:23 -0500
commit6d2ba68ee6842eee7ed28f8d127f37375f32d5c5 (patch)
tree788980ca39bf07a36a0dbea5d05928fd465cb988 /libflash/libffs.c
parent07426f41d24dc8006ede0b544ade3c1d72bae905 (diff)
downloadskiboot-6d2ba68ee6842eee7ed28f8d127f37375f32d5c5.zip
skiboot-6d2ba68ee6842eee7ed28f8d127f37375f32d5c5.tar.gz
skiboot-6d2ba68ee6842eee7ed28f8d127f37375f32d5c5.tar.bz2
libflash/libffs: ffs_close() should use ffs_hdr_free()
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash/libffs.c')
-rw-r--r--libflash/libffs.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/libflash/libffs.c b/libflash/libffs.c
index abc6138..4f1852f 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -440,14 +440,32 @@ out:
return rc;
}
-void ffs_close(struct ffs_handle *ffs)
+static void __hdr_free(struct ffs_hdr *hdr)
{
struct ffs_entry *ent, *next;
- list_for_each_safe(&ffs->hdr.entries, ent, next, list) {
+ list_for_each_safe(&hdr->entries, ent, next, list) {
list_del(&ent->list);
free(ent);
}
+ if (hdr->side) {
+ hdr->side->side = NULL;
+ ffs_hdr_free(hdr->side);
+ }
+}
+
+int ffs_hdr_free(struct ffs_hdr *hdr)
+{
+ printf("Freeing hdr\n");
+ __hdr_free(hdr);
+ free(hdr);
+
+ return 0;
+}
+
+void ffs_close(struct ffs_handle *ffs)
+{
+ __hdr_free(&ffs->hdr);
if (ffs->cache)
free(ffs->cache);
@@ -903,24 +921,6 @@ int ffs_hdr_new(uint32_t block_size, uint32_t block_count, struct ffs_hdr **r)
return 0;
}
-int ffs_hdr_free(struct ffs_hdr *hdr)
-{
- struct ffs_entry *ent, *next;
-
- printf("Freeing hdr\n");
- list_for_each_safe(&hdr->entries, ent, next, list) {
- list_del(&ent->list);
- free(ent);
- }
- if (hdr->side) {
- hdr->side->side = NULL;
- ffs_hdr_free(hdr->side);
- }
- free(hdr);
-
- return 0;
-}
-
int ffs_update_act_size(struct ffs_handle *ffs, uint32_t part_idx,
uint32_t act_size)
{