linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linuxppc-dev@lists.ozlabs.org,
	Anju T Sudhakar <anju@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Bhumika Goyal <bhumirks@gmail.com>,
	Corentin Labbe <clabbe.montjoie@gmail.com>,
	Hemant Kumar <hemant@linux.vnet.ibm.com>,
	Madhavan Srinivasan <maddy@linux.vnet.ibm.com>,
	Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Michael Neuling <mikey@neuling.org>,
	Neelesh Gupta <neelegup@linux.vnet.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Paul Mackerras <paulus@samba.org>, Rob Herring <robh@kernel.org>,
	Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>,
	Stewart Smith <stewart@linux.vnet.ibm.com>,
	Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
	Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/3] powerpc-opal: Delete ten error messages for a failed memory allocation
Date: Tue, 17 Oct 2017 14:11:49 +0200	[thread overview]
Message-ID: <e6e32520-c500-72b9-ce85-418f2f859af3@users.sourceforge.net> (raw)
In-Reply-To: <5fb4f314-cd23-c439-ab13-96b8188070e0@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 12:21:40 +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>
---
 arch/powerpc/platforms/powernv/opal-async.c        |  2 --
 arch/powerpc/platforms/powernv/opal-dump.c         |  1 -
 arch/powerpc/platforms/powernv/opal-flash.c        |  4 +---
 arch/powerpc/platforms/powernv/opal-hmi.c          |  5 ++---
 .../powerpc/platforms/powernv/opal-memory-errors.c |  6 ++----
 arch/powerpc/platforms/powernv/opal-sysparam.c     | 25 +++++-----------------
 6 files changed, 10 insertions(+), 33 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-async.c b/arch/powerpc/platforms/powernv/opal-async.c
index cf33769a7b72..2b11d8444b5a 100644
--- a/arch/powerpc/platforms/powernv/opal-async.c
+++ b/arch/powerpc/platforms/powernv/opal-async.c
@@ -193,8 +193,6 @@ int __init opal_async_comp_init(void)
 			sizeof(*opal_async_responses) * opal_max_async_tokens,
 			GFP_KERNEL);
 	if (!opal_async_responses) {
-		pr_err("%s: Out of memory, failed to do asynchronous "
-				"completion init\n", __func__);
 		err = -ENOMEM;
 		goto out_opal_node;
 	}
diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c
index 4c827826c05e..b54864feef84 100644
--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -244,7 +244,6 @@ static int64_t dump_read_data(struct dump_obj *dump)
 	/* Allocate memory */
 	dump->buffer = vzalloc(PAGE_ALIGN(dump->size));
 	if (!dump->buffer) {
-		pr_err("%s : Failed to allocate memory\n", __func__);
 		rc = -ENOMEM;
 		goto out;
 	}
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index 2fa3ac80cb4e..77d564266a59 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -437,10 +437,8 @@ static int alloc_image_buf(char *buffer, size_t count)
 	}
 
 	image_data.data = vzalloc(PAGE_ALIGN(image_data.size));
-	if (!image_data.data) {
-		pr_err("%s : Failed to allocate memory\n", __func__);
+	if (!image_data.data)
 		return -ENOMEM;
-	}
 
 	/* Pin memory */
 	addr = image_data.data;
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c
index d78fed728cdf..b7dfe41a0a96 100644
--- a/arch/powerpc/platforms/powernv/opal-hmi.c
+++ b/arch/powerpc/platforms/powernv/opal-hmi.c
@@ -310,10 +310,9 @@ static int opal_handle_hmi_event(struct notifier_block *nb,
 
 	/* Delay the logging of HMI events to workqueue. */
 	msg_node = kzalloc(sizeof(*msg_node), GFP_ATOMIC);
-	if (!msg_node) {
-		pr_err("HMI: out of memory, Opal message event not handled\n");
+	if (!msg_node)
 		return -ENOMEM;
-	}
+
 	memcpy(&msg_node->hmi_evt, hmi_evt, sizeof(struct OpalHMIEvent));
 
 	spin_lock_irqsave(&opal_hmi_evt_lock, flags);
diff --git a/arch/powerpc/platforms/powernv/opal-memory-errors.c b/arch/powerpc/platforms/powernv/opal-memory-errors.c
index 4495f428b500..8d76c05252d1 100644
--- a/arch/powerpc/platforms/powernv/opal-memory-errors.c
+++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c
@@ -107,11 +107,9 @@ static int opal_memory_err_event(struct notifier_block *nb,
 		return 0;
 
 	msg_node = kzalloc(sizeof(*msg_node), GFP_ATOMIC);
-	if (!msg_node) {
-		pr_err("MEMORY_ERROR: out of memory, Opal message event not"
-		       "handled\n");
+	if (!msg_node)
 		return -ENOMEM;
-	}
+
 	memcpy(&msg_node->msg, msg, sizeof(struct opal_msg));
 
 	spin_lock_irqsave(&opal_mem_err_lock, flags);
diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c
index 23fb6647dced..1df05efe55a1 100644
--- a/arch/powerpc/platforms/powernv/opal-sysparam.c
+++ b/arch/powerpc/platforms/powernv/opal-sysparam.c
@@ -184,11 +184,8 @@ void __init opal_sys_param_init(void)
 
 	/* Allocate big enough buffer for any get/set transactions */
 	param_data_buf = kzalloc(MAX_PARAM_DATA_LEN, GFP_KERNEL);
-	if (!param_data_buf) {
-		pr_err("SYSPARAM: Failed to allocate memory for param data "
-				"buf\n");
+	if (!param_data_buf)
 		goto out_kobj_put;
-	}
 
 	/* Number of parameters exposed through DT */
 	count = of_property_count_strings(sysparam, "param-name");
@@ -199,25 +196,16 @@ void __init opal_sys_param_init(void)
 	}
 
 	id = kzalloc(sizeof(*id) * count, GFP_KERNEL);
-	if (!id) {
-		pr_err("SYSPARAM: Failed to allocate memory to read parameter "
-				"id\n");
+	if (!id)
 		goto out_param_buf;
-	}
 
 	size = kzalloc(sizeof(*size) * count, GFP_KERNEL);
-	if (!size) {
-		pr_err("SYSPARAM: Failed to allocate memory to read parameter "
-				"size\n");
+	if (!size)
 		goto out_free_id;
-	}
 
 	perm = kzalloc(sizeof(*perm) * count, GFP_KERNEL);
-	if (!perm) {
-		pr_err("SYSPARAM: Failed to allocate memory to read supported "
-				"action on the parameter");
+	if (!perm)
 		goto out_free_size;
-	}
 
 	if (of_property_read_u32_array(sysparam, "param-id", id, count)) {
 		pr_err("SYSPARAM: Missing property param-id in the DT\n");
@@ -236,11 +224,8 @@ void __init opal_sys_param_init(void)
 	}
 
 	attr = kzalloc(sizeof(*attr) * count, GFP_KERNEL);
-	if (!attr) {
-		pr_err("SYSPARAM: Failed to allocate memory for parameter "
-				"attributes\n");
+	if (!attr)
 		goto out_free_perm;
-	}
 
 	/* For each of the parameters, populate the parameter attributes */
 	for (i = 0; i < count; i++) {
-- 
2.14.2

  reply	other threads:[~2017-10-17 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 12:10 [PATCH 0/3] PowerPC-OPAL: Adjustments for some function implementations SF Markus Elfring
2017-10-17 12:11 ` SF Markus Elfring [this message]
2017-10-17 12:12 ` [PATCH 2/3] powerpc-opal: Improve 12 size determinations SF Markus Elfring
2017-10-17 12:14 ` [PATCH 3/3] powerpc-opal: Fix a typo in a comment line of two file headers SF Markus Elfring
2017-10-24  8:09   ` [3/3] " Michael Ellerman

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=e6e32520-c500-72b9-ce85-418f2f859af3@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=anju@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhumirks@gmail.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=hegdevasant@linux.vnet.ibm.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mahesh@linux.vnet.ibm.com \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=neelegup@linux.vnet.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.org \
    --cc=robh@kernel.org \
    --cc=shilpa.bhat@linux.vnet.ibm.com \
    --cc=stewart@linux.vnet.ibm.com \
    --cc=tyreld@linux.vnet.ibm.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).