Author: myles
Date: 2009-10-09 17:22:35 +0200 (Fri, 09 Oct 2009)
New Revision: 4752

Modified:
   trunk/coreboot-v2/src/include/cbfs.h
   trunk/coreboot-v2/src/lib/cbfs.c
Log:
Move the ulzma prototype out of the function to make the code easier to read.

Check the return value.  Minor formatting and LAR -> CBFS.

Signed-off-by: Myles Watson <[email protected]>
Acked-by: Peter Stuge <[email protected]>


Modified: trunk/coreboot-v2/src/include/cbfs.h
===================================================================
--- trunk/coreboot-v2/src/include/cbfs.h        2009-10-09 14:10:28 UTC (rev 
4751)
+++ trunk/coreboot-v2/src/include/cbfs.h        2009-10-09 15:22:35 UTC (rev 
4752)
@@ -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

Modified: trunk/coreboot-v2/src/lib/cbfs.c
===================================================================
--- trunk/coreboot-v2/src/lib/cbfs.c    2009-10-09 14:10:28 UTC (rev 4751)
+++ trunk/coreboot-v2/src/lib/cbfs.c    2009-10-09 15:22:35 UTC (rev 4752)
@@ -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 @@
                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;
        }
 }


-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to