Commit 99e7fc8a2659ff1b2887c8b11b01ef423e00ee1c

Authored by Erik Tideman
Committed by Tom Rini
1 parent 1d48ca69e5

mmc: emmc and hw partitions partition table id bugfix.

On bootup the emmc's hw partition is always set to 0 and the partition
table is read from it. When switching to another hw partition the
partition table's id is not updated but instead the old one from
hw partition 0 is used. If there is no partition table on hw partition 0
then the code will terminate and return error even if the desired hw
partition contains a perfectly fine partition table. This fix updates
the partition table struct to correspond to the specified hw partition
before testing if the partition table is valid or not.

Signed-off-by: Erik Tideman <erik.tideman@faltcom.se>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Squash the patch that corrected whitespace in the original into
this one, wrap with HAVE_BLOCK_DEVICE test]
Signed-off-by: Tom Rini <trini@konsulko.com>

Showing 1 changed file with 10 additions and 0 deletions Side-by-side Diff

... ... @@ -493,6 +493,16 @@
493 493 goto cleanup;
494 494 }
495 495  
  496 +#ifdef HAVE_BLOCK_DEVICE
  497 + /*
  498 + * Updates the partition table for the specified hw partition.
  499 + * Does not need to be done for hwpart 0 since it is default and
  500 + * already loaded.
  501 + */
  502 + if(hwpart != 0)
  503 + init_part(*dev_desc);
  504 +#endif
  505 +
496 506 cleanup:
497 507 free(dup_str);
498 508 return dev;