linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 4/4] target: Delete an error message for a failed memory allocation in two functions
Date: Sat, 4 Nov 2017 14:18:59 +0100	[thread overview]
Message-ID: <e6282832-737d-f3a5-bb1a-70fc53c58451@users.sourceforge.net> (raw)
In-Reply-To: <27e27d42-473d-e8db-fe9e-803fed646881@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 4 Nov 2017 13:43:22 +0100

Omit an extra message 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>
---
 drivers/target/target_core_xcopy.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
index 1519e399392b..c2b3d3158208 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -681,10 +681,9 @@ static int target_xcopy_read_source(
 	bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP);
 
 	xpt_cmd = kzalloc(sizeof(*xpt_cmd), GFP_KERNEL);
-	if (!xpt_cmd) {
-		pr_err("Unable to allocate xcopy_pt_cmd\n");
+	if (!xpt_cmd)
 		return -ENOMEM;
-	}
+
 	init_completion(&xpt_cmd->xpt_passthrough_sem);
 	se_cmd = &xpt_cmd->se_cmd;
 
@@ -743,10 +742,9 @@ static int target_xcopy_write_destination(
 	bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP);
 
 	xpt_cmd = kzalloc(sizeof(*xpt_cmd), GFP_KERNEL);
-	if (!xpt_cmd) {
-		pr_err("Unable to allocate xcopy_pt_cmd\n");
+	if (!xpt_cmd)
 		return -ENOMEM;
-	}
+
 	init_completion(&xpt_cmd->xpt_passthrough_sem);
 	se_cmd = &xpt_cmd->se_cmd;
 
-- 
2.15.0

      parent reply	other threads:[~2017-11-04 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04 13:14 [PATCH 0/4] target: Adjustments for four function implementations SF Markus Elfring
2017-11-04 13:15 ` [PATCH 1/4] target: Use common error handling code in three functions SF Markus Elfring
2017-11-04 13:16 ` [PATCH 2/4] target: Combine two condition checks into one statement in target_xcopy_do_work() SF Markus Elfring
2017-11-04 13:17 ` [PATCH 3/4] target: Improve a size determination in three functions SF Markus Elfring
2017-11-04 13:18 ` SF Markus Elfring [this message]

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=e6282832-737d-f3a5-bb1a-70fc53c58451@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /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).