aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:14:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:14:44 -0400
commit04bbc8e1f68cf4c1aac8024d6aea1a24757e8a5a (patch)
tree9eee2dd7cca805dc27490a624160ef6d9ddd7dd1 /drivers
parente39dfe52f8f67061317e7108f62a2b33a3d06580 (diff)
parent0d838347f1325cebfe8b9341a4b4c1f407022231 (diff)
Merge tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux
Pull pstore update from Tony Luck: "Fixes for pstore for 3.11 merge window" * tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux: efivars: If pstore_register fails, free unneeded pstore buffer acpi: Eliminate console msg if pstore.backend excludes ERST pstore: Return unique error if backend registration excluded by kernel param pstore: Fail to unlink if a driver has not defined pstore_erase pstore/ram: remove the power of buffer size limitation pstore/ram: avoid atomic accesses for ioremapped regions efi, pstore: Cocci spatch "memdup.spatch"
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/apei/erst.c20
-rw-r--r--drivers/firmware/efi/efi-pstore.c9
2 files changed, 20 insertions, 9 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 6d894bfd8b8f..f7b3b39e94fc 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -1180,20 +1180,28 @@ static int __init erst_init(void)
1180 if (!erst_erange.vaddr) 1180 if (!erst_erange.vaddr)
1181 goto err_release_erange; 1181 goto err_release_erange;
1182 1182
1183 pr_info(ERST_PFX
1184 "Error Record Serialization Table (ERST) support is initialized.\n");
1185
1183 buf = kmalloc(erst_erange.size, GFP_KERNEL); 1186 buf = kmalloc(erst_erange.size, GFP_KERNEL);
1184 spin_lock_init(&erst_info.buf_lock); 1187 spin_lock_init(&erst_info.buf_lock);
1185 if (buf) { 1188 if (buf) {
1186 erst_info.buf = buf + sizeof(struct cper_pstore_record); 1189 erst_info.buf = buf + sizeof(struct cper_pstore_record);
1187 erst_info.bufsize = erst_erange.size - 1190 erst_info.bufsize = erst_erange.size -
1188 sizeof(struct cper_pstore_record); 1191 sizeof(struct cper_pstore_record);
1189 if (pstore_register(&erst_info)) { 1192 rc = pstore_register(&erst_info);
1190 pr_info(ERST_PFX "Could not register with persistent store\n"); 1193 if (rc) {
1194 if (rc != -EPERM)
1195 pr_info(ERST_PFX
1196 "Could not register with persistent store\n");
1197 erst_info.buf = NULL;
1198 erst_info.bufsize = 0;
1191 kfree(buf); 1199 kfree(buf);
1192 } 1200 }
1193 } 1201 } else
1194 1202 pr_err(ERST_PFX
1195 pr_info(ERST_PFX 1203 "Failed to allocate %lld bytes for persistent store error log\n",
1196 "Error Record Serialization Table (ERST) support is initialized.\n"); 1204 erst_erange.size);
1197 1205
1198 return 0; 1206 return 0;
1199 1207
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 202d2c85ba2e..91864ad200ff 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -79,10 +79,9 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
79 &entry->var.DataSize, entry->var.Data); 79 &entry->var.DataSize, entry->var.Data);
80 size = entry->var.DataSize; 80 size = entry->var.DataSize;
81 81
82 *cb_data->buf = kmalloc(size, GFP_KERNEL); 82 *cb_data->buf = kmemdup(entry->var.Data, size, GFP_KERNEL);
83 if (*cb_data->buf == NULL) 83 if (*cb_data->buf == NULL)
84 return -ENOMEM; 84 return -ENOMEM;
85 memcpy(*cb_data->buf, entry->var.Data, size);
86 return size; 85 return size;
87} 86}
88 87
@@ -236,7 +235,11 @@ static __init int efivars_pstore_init(void)
236 efi_pstore_info.bufsize = 1024; 235 efi_pstore_info.bufsize = 1024;
237 spin_lock_init(&efi_pstore_info.buf_lock); 236 spin_lock_init(&efi_pstore_info.buf_lock);
238 237
239 pstore_register(&efi_pstore_info); 238 if (pstore_register(&efi_pstore_info)) {
239 kfree(efi_pstore_info.buf);
240 efi_pstore_info.buf = NULL;
241 efi_pstore_info.bufsize = 0;
242 }
240 243
241 return 0; 244 return 0;
242} 245}