2018-01-27 18:18:08

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 0/3] IB-iSER: Adjustments for three function implementations

From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2018 19:02:34 +0100

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

Markus Elfring (3):
Delete an error message for a failed memory allocation in iser_send_data_out()
Delete an unnecessary variable initialisation in iser_send_data_out()
Combine substrings for three messages

drivers/infiniband/ulp/iser/iser_initiator.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

--
2.16.1



2018-01-27 18:19:49

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 1/3] IB/iser: Delete an error message for a failed memory allocation in iser_send_data_out()

From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2018 17:48:47 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/infiniband/ulp/iser/iser_initiator.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 2a07692007bd..3ae2571ba5b4 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -452,10 +452,8 @@ int iser_send_data_out(struct iscsi_conn *conn,
__func__,(int)itt,(int)data_seg_len,(int)buf_offset);

tx_desc = kmem_cache_zalloc(ig.desc_cache, GFP_ATOMIC);
- if (tx_desc == NULL) {
- iser_err("Failed to alloc desc for post dataout\n");
+ if (!tx_desc)
return -ENOMEM;
- }

tx_desc->type = ISCSI_TX_DATAOUT;
tx_desc->cqe.done = iser_dataout_comp;
--
2.16.1


2018-01-27 18:21:32

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 2/3] IB/iser: Delete an unnecessary variable initialisation in iser_send_data_out()

From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2018 17:55:13 +0100

The variable "tx_desc" will be set to an appropriate pointer a bit later.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/infiniband/ulp/iser/iser_initiator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 3ae2571ba5b4..1425c4957a04 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -436,7 +436,7 @@ int iser_send_data_out(struct iscsi_conn *conn,
{
struct iser_conn *iser_conn = conn->dd_data;
struct iscsi_iser_task *iser_task = task->dd_data;
- struct iser_tx_desc *tx_desc = NULL;
+ struct iser_tx_desc *tx_desc;
struct iser_mem_reg *mem_reg;
unsigned long buf_offset;
unsigned long data_seg_len;
--
2.16.1


2018-01-27 18:23:12

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 3/3] IB/iser: Combine substrings for three messages

From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2018 18:25:37 +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 <[email protected]>
---
drivers/infiniband/ulp/iser/iser_initiator.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 1425c4957a04..df49c4eb67f7 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -142,8 +142,7 @@ iser_prepare_write_cmd(struct iscsi_task *task,
hdr->write_va = cpu_to_be64(mem_reg->sge.addr + unsol_sz);
}

- iser_dbg("Cmd itt:%d, WRITE tags, RKEY:%#.4X "
- "VA:%#llX + unsol:%d\n",
+ iser_dbg("Cmd itt:%d, WRITE tags, RKEY:%#.4X VA:%#llX + unsol:%d\n",
task->itt, mem_reg->rkey,
(unsigned long long)mem_reg->sge.addr, unsol_sz);
}
@@ -473,8 +472,7 @@ int iser_send_data_out(struct iscsi_conn *conn,
tx_desc->num_sge = 2;

if (buf_offset + data_seg_len > iser_task->data[ISER_DIR_OUT].data_len) {
- iser_err("Offset:%ld & DSL:%ld in Data-Out "
- "inconsistent with total len:%ld, itt:%d\n",
+ iser_err("Offset:%ld & DSL:%ld in Data-Out inconsistent with total len:%ld, itt:%d\n",
buf_offset, data_seg_len,
iser_task->data[ISER_DIR_OUT].data_len, itt);
err = -EINVAL;
@@ -612,8 +610,8 @@ iser_check_remote_inv(struct iser_conn *iser_conn,
iser_conn, rkey);

if (unlikely(!iser_conn->snd_w_inv)) {
- iser_err("conn %p: unexpected remote invalidation, "
- "terminating connection\n", iser_conn);
+ iser_err("conn %p: unexpected remote invalidation, terminating connection\n",
+ iser_conn);
return -EPROTO;
}

--
2.16.1


2018-01-28 14:42:08

by Max Gurtovoy

[permalink] [raw]
Subject: Re: [PATCH 0/3] IB-iSER: Adjustments for three function implementations



On 1/27/2018 8:17 PM, SF Markus Elfring wrote:
> From: Markus Elfring <[email protected]>
> Date: Sat, 27 Jan 2018 19:02:34 +0100
>
> Three update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (3):
> Delete an error message for a failed memory allocation in iser_send_data_out()
> Delete an unnecessary variable initialisation in iser_send_data_out()
> Combine substrings for three messages
>
> drivers/infiniband/ulp/iser/iser_initiator.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>

This series looks good to me,

Reviewed-by: Max Gurtovoy <[email protected]>

2018-01-28 21:48:01

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH 0/3] IB-iSER: Adjustments for three function implementations

On Sun, Jan 28, 2018 at 04:41:16PM +0200, Max Gurtovoy wrote:
>
>
> On 1/27/2018 8:17 PM, SF Markus Elfring wrote:
> >From: Markus Elfring <[email protected]>
> >Date: Sat, 27 Jan 2018 19:02:34 +0100
> >
> >Three update suggestions were taken into account
> >from static source code analysis.
> >
> >Markus Elfring (3):
> > Delete an error message for a failed memory allocation in iser_send_data_out()
> > Delete an unnecessary variable initialisation in iser_send_data_out()
> > Combine substrings for three messages
> >
> > drivers/infiniband/ulp/iser/iser_initiator.c | 16 ++++++----------
> > 1 file changed, 6 insertions(+), 10 deletions(-)
> >
>
> This series looks good to me,
>
> Reviewed-by: Max Gurtovoy <[email protected]>

Okay, applied to for-next, thanks both

Jason

2018-01-29 10:29:41

by SF Markus Elfring

[permalink] [raw]
Subject: Re: [0/3] IB-iSER: Adjustments for three function implementations

> Okay, applied to for-next, thanks both

Thanks for your acceptance.

How are the chances for integration of further software updates
from my selection of change possibilities?

Example:
IB/iser: Add spaces for better code readability
https://lkml.org/lkml/2017/4/7/667
https://patchwork.kernel.org/patch/9670439/
https://lkml.kernel.org/r/<[email protected]>

Regards,
Markus