]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
lib: make table_compute_checksum() arguments const
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 9 Jan 2024 08:36:44 +0000 (09:36 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 9 Jan 2024 09:08:52 +0000 (10:08 +0100)
table_compute_checksum() does neither changes the content of the
checksummed buffer nor the buffer length. Adding const to the
definition makes the function wider usable.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
include/tables_csum.h
lib/tables_csum.c

index 4812333093a1e90dd306f29f73790b3a9eaea9a1..9207e85f91bf00f7fdbf0c6f400e6c036af31a66 100644 (file)
@@ -17,6 +17,6 @@
  * @len:       configuration table size
  * @return:    the 8-bit checksum
  */
-u8 table_compute_checksum(void *v, int len);
+u8 table_compute_checksum(const void *v, const int len);
 
 #endif
index 636aa596768178df8a7ae173faed396c45e98501..305b1ec31c5488a7417ff6d8ceedac06d6e5e35d 100644 (file)
@@ -5,9 +5,9 @@
 
 #include <linux/types.h>
 
-u8 table_compute_checksum(void *v, int len)
+u8 table_compute_checksum(const void *v, const int len)
 {
-       u8 *bytes = v;
+       const u8 *bytes = v;
        u8 checksum = 0;
        int i;