[U-Boot] [PATCH 11/26] binman: Fix up ProcessUpdateContents error and comments

Simon Glass sjg at chromium.org
Tue Jul 2 00:24:40 UTC 2019


This function raises an exception with its arguments around the wrong way
so the message is incorrect. Fix this as well as a few minor comment
problems.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/binman/entry.py | 8 ++++----
 tools/binman/ftest.py | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index a04e149d96c..b19a3b026f2 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -237,25 +237,25 @@ class Entry(object):
         This sets both the data and content_size properties
 
         Args:
-            data: Data to set to the contents (string)
+            data: Data to set to the contents (bytes)
         """
         self.data = data
         self.contents_size = len(self.data)
 
     def ProcessContentsUpdate(self, data):
-        """Update the contens of an entry, after the size is fixed
+        """Update the contents of an entry, after the size is fixed
 
         This checks that the new data is the same size as the old.
 
         Args:
-            data: Data to set to the contents (string)
+            data: Data to set to the contents (bytes)
 
         Raises:
             ValueError if the new data size is not the same as the old
         """
         if len(data) != self.contents_size:
             self.Raise('Cannot update entry size from %d to %d' %
-                       (len(data), self.contents_size))
+                       (self.contents_size, len(data)))
         self.SetContents(data)
 
     def ObtainContents(self):
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index f1a79baa905..8c9942982ba 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1213,7 +1213,7 @@ class TestFunctional(unittest.TestCase):
         with self.assertRaises(ValueError) as e:
             self._DoReadFile('059_change_size.dts', True)
         self.assertIn("Node '/binman/_testing': Cannot update entry size from "
-                      '2 to 1', str(e.exception))
+                      '1 to 2', str(e.exception))
 
     def testUpdateFdt(self):
         """Test that we can update the device tree with offset/size info"""
-- 
2.22.0.410.gd8fdbe21b5-goog



More information about the U-Boot mailing list