Move the ulzma prototype out of the function to make the code easier to read.
authorMyles Watson <mylesgw@gmail.com>
Fri, 9 Oct 2009 15:22:35 +0000 (15:22 +0000)
committerMyles Watson <mylesgw@gmail.com>
Fri, 9 Oct 2009 15:22:35 +0000 (15:22 +0000)
Check the return value.  Minor formatting and LAR -> CBFS.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4752 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/include/cbfs.h
src/lib/cbfs.c

index bca089a73bcb31a4f868a76455e3b92d3621e0bb..a6b2c027b37c099afeafa83f8b901070e04d217a 100644 (file)
@@ -52,7 +52,7 @@
 #include <boot/coreboot_tables.h>
 /** These are standard values for the known compression
     alogrithms that coreboot knows about for stages and
-    payloads.  Of course, other LAR users can use whatever
+    payloads.  Of course, other CBFS users can use whatever
     values they want, as long as they understand them. */
 
 #define CBFS_COMPRESS_NONE  0
index ad45ece95a32bdb6d41bb8644b5d43819e3c5bc2..780d69f4882f1e2740c50a8d9fe96705e7137c74 100644 (file)
@@ -29,6 +29,8 @@
 #define ntohl(x) (x)
 #endif
 
+unsigned long ulzma(unsigned char *src, unsigned char *dst);
+
 int cbfs_decompress(int algo, void *src, void *dst, int len)
 {
        switch(algo) {
@@ -36,15 +38,15 @@ int cbfs_decompress(int algo, void *src, void *dst, int len)
                memcpy(dst, src, len);
                return 0;
 
-       case CBFS_COMPRESS_LZMA: {
-               unsigned long ulzma(unsigned char *src, unsigned char *dst);
-               ulzma(src, dst);
-       }
+       case CBFS_COMPRESS_LZMA:
+               if (!ulzma(src, dst)) {
+                       printk_err("CBFS: LZMA decompression failed!\n");
+                       return -1;
+               }
                return 0;
 
        default:
-               printk_info( "CBFS:  Unknown compression type %d\n",
-                      algo);
+               printk_info( "CBFS:  Unknown compression type %d\n", algo);
                return -1;
        }
 }