]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pstore: constify pstore_zbackend structures
authorBhumika Goyal <bhumirks@gmail.com>
Sun, 19 Feb 2017 09:37:53 +0000 (15:07 +0530)
committerKees Cook <keescook@chromium.org>
Tue, 7 Mar 2017 16:21:38 +0000 (08:21 -0800)
The references of pstore_zbackend structures are stored into the
pointer zbackend of type struct pstore_zbackend. The pointer zbackend
can be made const as it is only dereferenced. After making this change
the pstore_zbackend structures whose references are stored into the
pointer zbackend can be made const too.

File size before:
   text    data     bss     dec     hex filename
   4817     541     172    5530    159a fs/pstore/platform.o

File size after:
   text    data     bss     dec     hex filename
   4865     477     172    5514    158a fs/pstore/platform.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/platform.c

index efab7b64925ba76e2aa0a2a39d9e659c0a94472e..cfc1abd264d90e6e099b0be2d1c3b6502a2f6951 100644 (file)
@@ -267,7 +267,7 @@ static void free_zlib(void)
        big_oops_buf_sz = 0;
 }
 
-static struct pstore_zbackend backend_zlib = {
+static const struct pstore_zbackend backend_zlib = {
        .compress       = compress_zlib,
        .decompress     = decompress_zlib,
        .allocate       = allocate_zlib,
@@ -328,7 +328,7 @@ static void free_lzo(void)
        big_oops_buf_sz = 0;
 }
 
-static struct pstore_zbackend backend_lzo = {
+static const struct pstore_zbackend backend_lzo = {
        .compress       = compress_lzo,
        .decompress     = decompress_lzo,
        .allocate       = allocate_lzo,
@@ -393,7 +393,7 @@ static void free_lz4(void)
        big_oops_buf_sz = 0;
 }
 
-static struct pstore_zbackend backend_lz4 = {
+static const struct pstore_zbackend backend_lz4 = {
        .compress       = compress_lz4,
        .decompress     = decompress_lz4,
        .allocate       = allocate_lz4,
@@ -402,7 +402,7 @@ static struct pstore_zbackend backend_lz4 = {
 };
 #endif
 
-static struct pstore_zbackend *zbackend =
+static const struct pstore_zbackend *zbackend =
 #if defined(CONFIG_PSTORE_ZLIB_COMPRESS)
        &backend_zlib;
 #elif defined(CONFIG_PSTORE_LZO_COMPRESS)