From patchwork Tue Jun 18 15:53:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 1118409 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sedsystems.ca Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45T76g4X2sz9sN6 for ; Wed, 19 Jun 2019 11:44:43 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 011F1C22063; Wed, 19 Jun 2019 01:42:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B99A4C2206E; Wed, 19 Jun 2019 01:40:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0AA3CC21F37; Tue, 18 Jun 2019 15:53:08 +0000 (UTC) Received: from sed198n136.sedsystems.ca (sed198n136.SEDSystems.ca [198.169.180.136]) by lists.denx.de (Postfix) with ESMTPS id 7F466C21EE5 for ; Tue, 18 Jun 2019 15:53:07 +0000 (UTC) Received: from barney.sedsystems.ca (barney [198.169.180.121]) by sed198n136.sedsystems.ca with ESMTP id x5IFr6q4030715 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Jun 2019 09:53:06 -0600 (CST) Received: from SED.RFC1918.192.168.sedsystems.ca (eng1n65.eng.sedsystems.ca [172.21.1.65]) by barney.sedsystems.ca (8.14.7/8.14.4) with ESMTP id x5IFr6Ur021730 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 18 Jun 2019 09:53:06 -0600 From: Robert Hancock To: u-boot@lists.denx.de Date: Tue, 18 Jun 2019 09:53:04 -0600 Message-Id: <1560873184-21616-1-git-send-email-hancock@sedsystems.ca> X-Mailer: git-send-email 1.8.3.1 X-Scanned-By: MIMEDefang 2.64 on 198.169.180.136 X-Mailman-Approved-At: Wed, 19 Jun 2019 01:40:48 +0000 Subject: [U-Boot] [PATCH] disk: part: Don't skip partition init X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "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 --- 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: