U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] disk: part: Don't skip partition init
@ 2019-06-18 15:53 Robert Hancock
  2019-06-22 16:08 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Hancock @ 2019-06-18 15:53 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
---
 disk/part.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 862078f..f14bc22 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -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:
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-22 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-18 15:53 [U-Boot] [PATCH] disk: part: Don't skip partition init Robert Hancock
2019-06-22 16:08 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox