kernel: Correctly search for the FIT image in mtd partition.
Previously all iterations of the loop checked offset=0 in the partition. Signed-off-by: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
This commit is contained in:
		 Fredrik Olofsson
					Fredrik Olofsson
				
			
				
					committed by
					
						 Petr Štetiar
						Petr Štetiar
					
				
			
			
				
	
			
			
			 Petr Štetiar
						Petr Štetiar
					
				
			
						parent
						
							205e0939f0
						
					
				
				
					commit
					dc76900021
				
			| @@ -60,8 +60,8 @@ mtdsplit_fit_parse(struct mtd_info *mtd, | |||||||
| 	hdr_len = sizeof(struct fdt_header); | 	hdr_len = sizeof(struct fdt_header); | ||||||
|  |  | ||||||
| 	/* Parse the MTD device & search for the FIT image location */ | 	/* Parse the MTD device & search for the FIT image location */ | ||||||
| 	for(offset = 0; offset < mtd->size; offset += mtd->erasesize) { | 	for(offset = 0; offset + hdr_len < mtd->size; offset += mtd->erasesize) { | ||||||
| 		ret = mtd_read(mtd, 0, hdr_len, &retlen, (void*) &hdr); | 		ret = mtd_read(mtd, offset, hdr_len, &retlen, (void*) &hdr); | ||||||
| 		if (ret) { | 		if (ret) { | ||||||
| 			pr_err("read error in \"%s\" at offset 0x%llx\n", | 			pr_err("read error in \"%s\" at offset 0x%llx\n", | ||||||
| 			       mtd->name, (unsigned long long) offset); | 			       mtd->name, (unsigned long long) offset); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user