2021-02-17 21:22:41

by Colin King

[permalink] [raw]
Subject: [PATCH] pstore: remove redundant initialization of variable zipped_len

From: Colin Ian King <[email protected]>

The variable zipped_len is being initialized with a value that is
never read and it is being updated later with a new value. The
initialization is redundant and can be removed. Clean up the code
and move the scope of zipped_len.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
fs/pstore/platform.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 32f64abc277c..e79bc527289d 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -410,7 +410,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
char *dst;
size_t dst_size;
int header_size;
- int zipped_len = -1;
size_t dump_size;
struct pstore_record record;

@@ -440,6 +439,8 @@ static void pstore_dump(struct kmsg_dumper *dumper,
break;

if (big_oops_buf) {
+ int zipped_len;
+
zipped_len = pstore_compress(dst, psinfo->buf,
header_size + dump_size,
psinfo->bufsize);
--
2.30.0