- kernel_len *= master->erasesize;
-
- trx_parts[0].name = "u-boot";
- trx_parts[0].offset = 0;
- trx_parts[0].size = 4 * master->erasesize;
- trx_parts[0].mask_flags = MTD_WRITEABLE;
-
- trx_parts[1].name = "kernel";
- trx_parts[1].offset = trx_parts[0].offset + trx_parts[0].size;
- trx_parts[1].size = kernel_len;
- trx_parts[1].mask_flags = 0;
-
- trx_parts[2].name = "rootfs";
- trx_parts[2].offset = trx_parts[1].offset + trx_parts[1].size;
- trx_parts[2].size = master->size - 6 * master->erasesize - trx_parts[1].size;
- trx_parts[2].mask_flags = 0;
-
- trx_parts[3].name = "nvram";
- trx_parts[3].offset = master->size - 2 * master->erasesize;
- trx_parts[3].size = master->erasesize;
- trx_parts[3].mask_flags = MTD_WRITEABLE;
-
- trx_parts[4].name = "art";
- trx_parts[4].offset = master->size - master->erasesize;
- trx_parts[4].size = master->erasesize;
- trx_parts[4].mask_flags = MTD_WRITEABLE;
-
- trx_parts[5].name = "firmware";
- trx_parts[5].offset = 4 * master->erasesize;
- trx_parts[5].size = master->size - 6 * master->erasesize;
- trx_parts[5].mask_flags = 0;
-
- *pparts = trx_parts;
-
- return TRX_PARTS;
- } else {
- return 0;
- }
+
+ kernel_len++;
+ kernel_len *= master->erasesize;
+
+ trx_parts[0].name = "u-boot";
+ trx_parts[0].offset = 0;
+ trx_parts[0].size = 4 * master->erasesize;
+ trx_parts[0].mask_flags = MTD_WRITEABLE;
+
+ trx_parts[1].name = "kernel";
+ trx_parts[1].offset = trx_parts[0].offset + trx_parts[0].size;
+ trx_parts[1].size = kernel_len;
+ trx_parts[1].mask_flags = 0;
+
+ trx_parts[2].name = "rootfs";
+ trx_parts[2].offset = trx_parts[1].offset + trx_parts[1].size;
+ trx_parts[2].size = master->size - 6 * master->erasesize - trx_parts[1].size;
+ trx_parts[2].mask_flags = 0;
+
+ trx_parts[3].name = "nvram";
+ trx_parts[3].offset = master->size - 2 * master->erasesize;
+ trx_parts[3].size = master->erasesize;
+ trx_parts[3].mask_flags = MTD_WRITEABLE;
+
+ trx_parts[4].name = "art";
+ trx_parts[4].offset = master->size - master->erasesize;
+ trx_parts[4].size = master->erasesize;
+ trx_parts[4].mask_flags = MTD_WRITEABLE;
+
+ trx_parts[5].name = "firmware";
+ trx_parts[5].offset = 4 * master->erasesize;
+ trx_parts[5].size = master->size - 6 * master->erasesize;
+ trx_parts[5].mask_flags = 0;
+
+ *pparts = trx_parts;
+ ret = TRX_PARTS;
+
+ free_hdr:
+ vfree(header);
+ out:
+ return ret;