aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/pstore/ram.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 34ed8f860e23..6150e54eed30 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -164,6 +164,12 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec *time,
164 return header_length; 164 return header_length;
165} 165}
166 166
167static bool prz_ok(struct persistent_ram_zone *prz)
168{
169 return !!prz && !!(persistent_ram_old_size(prz) +
170 persistent_ram_ecc_string(prz, NULL, 0));
171}
172
167static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, 173static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
168 int *count, struct timespec *time, 174 int *count, struct timespec *time,
169 char **buf, bool *compressed, 175 char **buf, bool *compressed,
@@ -178,13 +184,13 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
178 prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt, 184 prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt,
179 cxt->max_dump_cnt, id, type, 185 cxt->max_dump_cnt, id, type,
180 PSTORE_TYPE_DMESG, 1); 186 PSTORE_TYPE_DMESG, 1);
181 if (!prz) 187 if (!prz_ok(prz))
182 prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt, 188 prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt,
183 1, id, type, PSTORE_TYPE_CONSOLE, 0); 189 1, id, type, PSTORE_TYPE_CONSOLE, 0);
184 if (!prz) 190 if (!prz_ok(prz))
185 prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt, 191 prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt,
186 1, id, type, PSTORE_TYPE_FTRACE, 0); 192 1, id, type, PSTORE_TYPE_FTRACE, 0);
187 if (!prz) 193 if (!prz_ok(prz))
188 return 0; 194 return 0;
189 195
190 if (!persistent_ram_old(prz)) 196 if (!persistent_ram_old(prz))