U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancock@sedsystems.ca>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] disk: part: Don't skip partition init
Date: Tue, 18 Jun 2019 09:53:04 -0600	[thread overview]
Message-ID: <1560873184-21616-1-git-send-email-hancock@sedsystems.ca> (raw)

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

             reply	other threads:[~2019-06-18 15:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18 15:53 Robert Hancock [this message]
2019-06-22 16:08 ` [U-Boot] [PATCH] disk: part: Don't skip partition init Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1560873184-21616-1-git-send-email-hancock@sedsystems.ca \
    --to=hancock@sedsystems.ca \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox