diff mbox series

RDMA/rtrs: server: use already dereferenced rtrs_sess structure

Message ID 20200522082833.1480551-1-haris.phnx@gmail.com (mailing list archive)
State Mainlined
Commit e172037be757dc7ab6ee67932c6663a2ff8cfd27
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/rtrs: server: use already dereferenced rtrs_sess structure | expand

Commit Message

Md Haris Iqbal May 22, 2020, 8:28 a.m. UTC
From: Md Haris Iqbal <haris.phnx@gmail.com>

The rtrs_sess structure has already been extracted above from the
rtrs_srv_sess structure. Use that to avoid redundant dereferencing.

Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
---
 drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Danil Kipnis May 22, 2020, 10:01 a.m. UTC | #1
On Fri, May 22, 2020 at 10:28 AM <haris.phnx@gmail.com> wrote:
>
> From: Md Haris Iqbal <haris.phnx@gmail.com>
>
> The rtrs_sess structure has already been extracted above from the
> rtrs_srv_sess structure. Use that to avoid redundant dereferencing.
>
> Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> index 1fc6ece036ff..5ef8988ee75b 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> @@ -1822,13 +1822,13 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id,
>                 /*
>                  * Sanity checks
>                  */
> -               if (con_num != sess->s.con_num || cid >= sess->s.con_num) {
> +               if (con_num != s->con_num || cid >= s->con_num) {
>                         rtrs_err(s, "Incorrect request: %d, %d\n",
>                                   cid, con_num);
>                         mutex_unlock(&srv->paths_mutex);
>                         goto reject_w_econnreset;
>                 }
> -               if (sess->s.con[cid]) {
> +               if (s->con[cid]) {
>                         rtrs_err(s, "Connection already exists: %d\n",
>                                   cid);
>                         mutex_unlock(&srv->paths_mutex);
> --
> 2.25.1
>

Acked-by: Danil Kipnis <danil.kipnis@cloud.ionos.com>

Thanks Haris.
Jason Gunthorpe May 23, 2020, 12:25 a.m. UTC | #2
On Fri, May 22, 2020 at 08:28:33AM +0000, haris.phnx@gmail.com wrote:
> From: Md Haris Iqbal <haris.phnx@gmail.com>
> 
> The rtrs_sess structure has already been extracted above from the
> rtrs_srv_sess structure. Use that to avoid redundant dereferencing.
> 
> Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
> Acked-by: Danil Kipnis <danil.kipnis@cloud.ionos.com>
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index 1fc6ece036ff..5ef8988ee75b 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -1822,13 +1822,13 @@  static int rtrs_rdma_connect(struct rdma_cm_id *cm_id,
 		/*
 		 * Sanity checks
 		 */
-		if (con_num != sess->s.con_num || cid >= sess->s.con_num) {
+		if (con_num != s->con_num || cid >= s->con_num) {
 			rtrs_err(s, "Incorrect request: %d, %d\n",
 				  cid, con_num);
 			mutex_unlock(&srv->paths_mutex);
 			goto reject_w_econnreset;
 		}
-		if (sess->s.con[cid]) {
+		if (s->con[cid]) {
 			rtrs_err(s, "Connection already exists: %d\n",
 				  cid);
 			mutex_unlock(&srv->paths_mutex);