- union yaffs_tags_union *tu = (union yaffs_tags_union *)tags_ptr;
-
- yaffs_calc_tags_ecc(tags_ptr);
-
- spare_ptr->tb0 = tu->as_bytes[0];
- spare_ptr->tb1 = tu->as_bytes[1];
- spare_ptr->tb2 = tu->as_bytes[2];
- spare_ptr->tb3 = tu->as_bytes[3];
- spare_ptr->tb4 = tu->as_bytes[4];
- spare_ptr->tb5 = tu->as_bytes[5];
- spare_ptr->tb6 = tu->as_bytes[6];
- spare_ptr->tb7 = tu->as_bytes[7];
+ union yaffs_tags_union *tu_ptr = (union yaffs_tags_union *)tags_ptr;
+ union yaffs_tags_union tags_stored = *tu_ptr;
+
+ yaffs_calc_tags_ecc(&tags_stored.as_tags);
+
+ yaffs_do_endian_u32(dev, &tags_stored.as_u32[0]);
+ yaffs_do_endian_u32(dev, &tags_stored.as_u32[1]);
+
+ spare_ptr->tb0 = tags_stored.as_bytes[0];
+ spare_ptr->tb1 = tags_stored.as_bytes[1];
+ spare_ptr->tb2 = tags_stored.as_bytes[2];
+ spare_ptr->tb3 = tags_stored.as_bytes[3];
+ spare_ptr->tb4 = tags_stored.as_bytes[4];
+ spare_ptr->tb5 = tags_stored.as_bytes[5];
+ spare_ptr->tb6 = tags_stored.as_bytes[6];
+ spare_ptr->tb7 = tags_stored.as_bytes[7];