disk: part: Don't skip partition init
PATCH 1/1 disk: part: Don't skip partition init
blk_get_device_by_str was skipping part_init when hw partition 0 was selected because it is the default. However, this caused issues when switching to a non-zero partition and then back to partition zero, as stale data from the wrong partition was returned.
Remove this optimization and call part_init regardless of the selected partition.
--- disk/part.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
disk/part.c +3 -4
@@ -414,11 +414,10 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,#ifdef CONFIG_HAVE_BLOCK_DEVICE /* * Updates the partition table for the specified hw partition. -* Does not need to be done for hwpart 0 since it is default and -* already loaded. +* Always should be done, otherwise hw partition 0 will return stale +* data after displaying a non-zero hw partition. */ -if (hwpart !=0 ) -part_init (*dev_desc); +part_init (*dev_desc);#endif cleanup:
Signature · 1 line
1.8.3.1
PATCH 1/1 disk: part: Don't skip partition init
Quoted 9 lines · Robert Hancock
blk_get_device_by_strwas skippingpart_initwhen hw partition 0 was selected because it is the default. However, this caused issues when switching to a non-zero partition and then back to partition zero, as stale data from the wrong partition was returned.Remove this optimization and call
part_initregardless of the selected partition.Signed-off-by Robert Hancock <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190622/4c3cbffd/attachment.sig>