From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>,
Kees Cook <keescook@chromium.org>,
Tony Luck <tony.luck@intel.com>,
kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] pstore: Delete six error messages for a failed memory allocation
Date: Wed, 16 Aug 2017 21:21:27 +0200 [thread overview]
Message-ID: <b0842266-6f8c-cba6-3cb5-98fc49f10f07@users.sourceforge.net> (raw)
In-Reply-To: <97737d95-d6aa-d24f-1af0-9d4895ceaed2@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 16 Aug 2017 20:30:44 +0200
Omit extra messages for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
fs/pstore/ram.c | 6 +-----
fs/pstore/ram_core.c | 15 ++++-----------
2 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 7125b398d312..42d27e5fac9f 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -719,7 +719,6 @@ static int ramoops_probe(struct platform_device *pdev)
if (dev_of_node(dev) && !pdata) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
- pr_err("cannot allocate platform data buffer\n");
err = -ENOMEM;
goto fail_out;
}
@@ -814,7 +813,6 @@ static int ramoops_probe(struct platform_device *pdev)
cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize);
cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL);
if (!cxt->pstore.buf) {
- pr_err("cannot allocate pstore buffer\n");
err = -ENOMEM;
goto fail_clear;
}
@@ -904,10 +902,8 @@ static void ramoops_register_dummy(void)
pr_info("using module parameters\n");
dummy_data = kzalloc(sizeof(*dummy_data), GFP_KERNEL);
- if (!dummy_data) {
- pr_info("could not allocate pdata\n");
+ if (!dummy_data)
return;
- }
dummy_data->mem_size = mem_size;
dummy_data->mem_address = mem_address;
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index e11672aa4575..fafa8af1289c 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -292,10 +292,8 @@ void persistent_ram_save_old(struct persistent_ram_zone *prz)
if (!prz->old_log) {
persistent_ram_ecc_old(prz);
prz->old_log = kmalloc(size, GFP_KERNEL);
- }
- if (!prz->old_log) {
- pr_err("failed to allocate buffer\n");
- return;
+ if (!prz->old_log)
+ return;
}
prz->old_log_size = size;
@@ -411,8 +409,5 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size,
- if (!pages) {
- pr_err("%s: Failed to allocate array for %u pages\n",
- __func__, page_count);
+ if (!pages)
return NULL;
- }
for (i = 0; i < page_count; i++) {
phys_addr_t addr = page_start + i * PAGE_SIZE;
@@ -529,7 +524,5 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
- if (!prz) {
- pr_err("failed to allocate persistent ram zone\n");
+ if (!prz)
goto err;
- }
/* Initialize general buffer state. */
raw_spin_lock_init(&prz->buffer_lock);
--
2.14.0
next prev parent reply other threads:[~2017-08-16 19:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 19:20 [PATCH 0/3] pstore: Adjustments for some function implementations SF Markus Elfring
2017-08-16 19:21 ` SF Markus Elfring [this message]
2017-08-16 19:32 ` [PATCH 1/3] pstore: Delete six error messages for a failed memory allocation Kees Cook
2017-08-16 19:58 ` SF Markus Elfring
2017-08-16 19:22 ` [PATCH 2/3] pstore: Improve a size determination in three functions SF Markus Elfring
2017-08-16 19:33 ` Kees Cook
2017-08-16 20:03 ` SF Markus Elfring
2017-08-16 19:23 ` [PATCH 3/3] pstore: Adjust two checks for null pointers SF Markus Elfring
2017-08-16 19:32 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0842266-6f8c-cba6-3cb5-98fc49f10f07@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=keescook@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).