Only load name if read succeeds
authorCharles Manning <cdhmanning@gmail.com>
Mon, 14 Jan 2019 23:58:21 +0000 (12:58 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Mon, 14 Jan 2019 23:58:21 +0000 (12:58 +1300)
Thanks Akiko for supplying this patch.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_guts.c

index 7678896..40a5b46 100644 (file)
@@ -4534,13 +4534,11 @@ int yaffs_get_obj_name(struct yaffs_obj *obj, YCHAR *name, int buffer_size)
 
                if (obj->hdr_chunk > 0) {
                        result = yaffs_rd_chunk_tags_nand(obj->my_dev,
-                                                         obj->hdr_chunk,
-                                                         buffer, NULL);
+                               obj->hdr_chunk, buffer, NULL);
+                       if (result == YAFFS_OK)
+                               yaffs_load_name_from_oh(obj->my_dev, name,
+                                       oh->name, buffer_size);
                }
-               if (result == YAFFS_OK)
-                       yaffs_load_name_from_oh(obj->my_dev, name, oh->name,
-                                       buffer_size);
-
                yaffs_release_temp_buffer(obj->my_dev, buffer);
        }