mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] target/iscsi/cxgbit: Adjustments for seven function implementations
@ 2017-12-12 12:20 SF Markus Elfring
  2017-12-12 12:21 ` [PATCH 1/2] target: cxgbit: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
  2017-12-12 12:23 ` [PATCH 2/2] target: cxgbit: Combine substrings for 11 messages SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-12 12:20 UTC (permalink / raw)
  To: target-devel, linux-scsi, Bart Van Assche, David S. Miller,
	Ingo Molnar, Johannes Berg, Nicholas A. Bellinger, Varun Prakash
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 12 Dec 2017 13:12:11 +0100

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Delete an error message for a failed memory allocation in two functions
  Combine substrings for 11 messages

 drivers/target/iscsi/cxgbit/cxgbit_target.c | 58 +++++++++--------------------
 1 file changed, 18 insertions(+), 40 deletions(-)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] target: cxgbit: Delete an error message for a failed memory allocation in two functions
  2017-12-12 12:20 [PATCH 0/2] target/iscsi/cxgbit: Adjustments for seven function implementations SF Markus Elfring
@ 2017-12-12 12:21 ` SF Markus Elfring
  2017-12-12 12:23 ` [PATCH 2/2] target: cxgbit: Combine substrings for 11 messages SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-12 12:21 UTC (permalink / raw)
  To: target-devel, linux-scsi, Bart Van Assche, David S. Miller,
	Ingo Molnar, Johannes Berg, Nicholas A. Bellinger, Varun Prakash
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 12 Dec 2017 11:34:51 +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/iscsi/cxgbit/cxgbit_target.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c
index 514986b57c2d..9163152b6d0b 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_target.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c
@@ -1126,8 +1126,6 @@ static int cxgbit_handle_nop_out(struct cxgbit_sock *csk, struct iscsi_cmd *cmd)
 	if (payload_length && hdr->ttt == cpu_to_be32(0xFFFFFFFF)) {
 		ping_data = kzalloc(payload_length + 1, GFP_KERNEL);
 		if (!ping_data) {
-			pr_err("Unable to allocate memory for"
-				" NOPOUT ping data.\n");
 			ret = -1;
 			goto out;
 		}
@@ -1188,11 +1186,9 @@ cxgbit_handle_text_cmd(struct cxgbit_sock *csk, struct iscsi_cmd *cmd)
 
 	if (payload_length) {
 		text_in = kzalloc(payload_length, GFP_KERNEL);
-		if (!text_in) {
-			pr_err("Unable to allocate text_in of payload_length: %u\n",
-			       payload_length);
+		if (!text_in)
 			return -ENOMEM;
-		}
+
 		skb_copy_bits(csk->skb, pdu_cb->doffset,
 			      text_in, payload_length);
 
-- 
2.15.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] target: cxgbit: Combine substrings for 11 messages
  2017-12-12 12:20 [PATCH 0/2] target/iscsi/cxgbit: Adjustments for seven function implementations SF Markus Elfring
  2017-12-12 12:21 ` [PATCH 1/2] target: cxgbit: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
@ 2017-12-12 12:23 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-12 12:23 UTC (permalink / raw)
  To: target-devel, linux-scsi, Bart Van Assche, David S. Miller,
	Ingo Molnar, Johannes Berg, Nicholas A. Bellinger, Varun Prakash
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 12 Dec 2017 12:57:47 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/target/iscsi/cxgbit/cxgbit_target.c | 50 +++++++++--------------------
 1 file changed, 16 insertions(+), 34 deletions(-)

diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c
index 9163152b6d0b..e4a0dbc8fb9d 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_target.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c
@@ -881,9 +881,7 @@ cxgbit_handle_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr,
 	if (pdu_cb->flags & PDUCBF_RX_DCRC_ERR) {
 		pr_err("ImmediateData CRC32C DataDigest error\n");
 		if (!conn->sess->sess_ops->ErrorRecoveryLevel) {
-			pr_err("Unable to recover from"
-			       " Immediate Data digest failure while"
-			       " in ERL=0.\n");
+			pr_err("Unable to recover from Immediate Data digest failure while in ERL=0.\n");
 			iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR,
 					  (unsigned char *)hdr);
 			return IMMEDIATE_DATA_CANNOT_RECOVER;
@@ -1054,19 +1052,14 @@ static int cxgbit_handle_iscsi_dataout(struct cxgbit_sock *csk)
 	}
 
 	if (pdu_cb->flags & PDUCBF_RX_DCRC_ERR) {
-		pr_err("ITT: 0x%08x, Offset: %u, Length: %u,"
-		       " DataSN: 0x%08x\n",
-		       hdr->itt, hdr->offset, data_len,
-		       hdr->datasn);
-
+		pr_err("ITT: 0x%08x, Offset: %u, Length: %u, DataSN: 0x%08x\n",
+		       hdr->itt, hdr->offset, data_len, hdr->datasn);
 		dcrc_err = true;
 		goto check_payload;
 	}
 
-	pr_debug("DataOut data_len: %u, "
-		"write_data_done: %u, data_length: %u\n",
-		  data_len,  cmd->write_data_done,
-		  cmd->se_cmd.data_length);
+	pr_debug("DataOut data_len: %u, write_data_done: %u, data_length: %u\n",
+		 data_len, cmd->write_data_done, cmd->se_cmd.data_length);
 
 	if (!(pdu_cb->flags & PDUCBF_RX_DATA_DDPD)) {
 		u32 skip = data_offset % PAGE_SIZE;
@@ -1102,9 +1095,7 @@ static int cxgbit_handle_nop_out(struct cxgbit_sock *csk, struct iscsi_cmd *cmd)
 
 	if (pdu_cb->flags & PDUCBF_RX_DCRC_ERR) {
 		if (!conn->sess->sess_ops->ErrorRecoveryLevel) {
-			pr_err("Unable to recover from"
-			       " NOPOUT Ping DataCRC failure while in"
-			       " ERL=0.\n");
+			pr_err("Unable to recover from NOPOUT Ping DataCRC failure while in ERL=0.\n");
 			ret = -1;
 			goto out;
 		} else {
@@ -1112,9 +1103,8 @@ static int cxgbit_handle_nop_out(struct cxgbit_sock *csk, struct iscsi_cmd *cmd)
 			 * drop this PDU and let the
 			 * initiator plug the CmdSN gap.
 			 */
-			pr_info("Dropping NOPOUT"
-				" Command CmdSN: 0x%08x due to"
-				" DataCRC error.\n", hdr->cmdsn);
+			pr_info("Dropping NOPOUT Command CmdSN: 0x%08x due to DataCRC error.\n",
+				hdr->cmdsn);
 			ret = 0;
 			goto out;
 		}
@@ -1139,9 +1129,7 @@ static int cxgbit_handle_nop_out(struct cxgbit_sock *csk, struct iscsi_cmd *cmd)
 		 */
 		cmd->buf_ptr = ping_data;
 		cmd->buf_ptr_size = payload_length;
-
-		pr_debug("Got %u bytes of NOPOUT ping"
-			" data.\n", payload_length);
+		pr_debug("Got %u bytes of NOPOUT ping data.\n", payload_length);
 		pr_debug("Ping Data: \"%s\"\n", ping_data);
 	}
 
@@ -1168,18 +1156,15 @@ cxgbit_handle_text_cmd(struct cxgbit_sock *csk, struct iscsi_cmd *cmd)
 
 	if (pdu_cb->flags & PDUCBF_RX_DCRC_ERR) {
 		if (!conn->sess->sess_ops->ErrorRecoveryLevel) {
-			pr_err("Unable to recover from"
-			       " Text Data digest failure while in"
-			       " ERL=0.\n");
+			pr_err("Unable to recover from Text Data digest failure while in ERL=0.\n");
 			goto reject;
 		} else {
 			/*
 			 * drop this PDU and let the
 			 * initiator plug the CmdSN gap.
 			 */
-			pr_info("Dropping Text"
-				" Command CmdSN: 0x%08x due to"
-				" DataCRC error.\n", hdr->cmdsn);
+			pr_info("Dropping Text Command CmdSN: 0x%08x due to DataCRC error.\n",
+				hdr->cmdsn);
 			return 0;
 		}
 	}
@@ -1302,8 +1287,8 @@ static int cxgbit_rx_opcode(struct cxgbit_sock *csk)
 	if (conn->sess->sess_ops->SessionType &&
 	    ((!(opcode & ISCSI_OP_TEXT)) ||
 	     (!(opcode & ISCSI_OP_LOGOUT)))) {
-		pr_err("Received illegal iSCSI Opcode: 0x%02x"
-			" while in Discovery Session, rejecting.\n", opcode);
+		pr_err("Received illegal iSCSI Opcode: 0x%02x while in Discovery Session, rejecting.\n",
+		       opcode);
 		iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR,
 				  (unsigned char *)hdr);
 		goto transport_err;
@@ -1327,9 +1312,7 @@ static int cxgbit_rx_login_pdu(struct cxgbit_sock *csk)
 
 	login_req = (struct iscsi_login_req *)login->req;
 	memcpy(login_req, pdu_cb->hdr, sizeof(*login_req));
-
-	pr_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x,"
-		" CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %hu, Length: %u\n",
+	pr_debug("Got Login Command, Flags 0x%02x, ITT: 0x%08x, CmdSN: 0x%08x, ExpStatSN: 0x%08x, CID: %hu, Length: %u\n",
 		login_req->flags, login_req->itt, login_req->cmdsn,
 		login_req->exp_statsn, login_req->cid, pdu_cb->dlen);
 	/*
@@ -1394,8 +1377,7 @@ static void cxgbit_lro_skb_dump(struct sk_buff *skb)
 		skb, lro_cb->csk, lro_cb->pdu_idx, lro_cb->pdu_totallen);
 
 	for (i = 0; i < lro_cb->pdu_idx; i++, pdu_cb++)
-		pr_info("skb 0x%p, pdu %d, %u, f 0x%x, seq 0x%x, dcrc 0x%x, "
-			"frags %u.\n",
+		pr_info("skb 0x%p, pdu %d, %u, f 0x%x, seq 0x%x, dcrc 0x%x, frags %u.\n",
 			skb, i, pdu_cb->pdulen, pdu_cb->flags, pdu_cb->seq,
 			pdu_cb->ddigest, pdu_cb->frags);
 	for (i = 0; i < ssi->nr_frags; i++)
-- 
2.15.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-12 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 12:20 [PATCH 0/2] target/iscsi/cxgbit: Adjustments for seven function implementations SF Markus Elfring
2017-12-12 12:21 ` [PATCH 1/2] target: cxgbit: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-12-12 12:23 ` [PATCH 2/2] target: cxgbit: Combine substrings for 11 messages SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome