Skip to content

Commit

Permalink
RDMA/rtrs-clt: Simplify error message
Browse files Browse the repository at this point in the history
Two error messages are only different message but have common
code to generate the path string.

Link: https://lore.kernel.org/r/20210406123639.202899-4-gi-oh.kim@ionos.com
Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
  • Loading branch information
Gioh Kim authored and Jason Gunthorpe committed Apr 13, 2021
1 parent 42cdc19 commit 7c71f0d
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions drivers/infiniband/ulp/rtrs/rtrs-clt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2522,33 +2522,24 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess *sess)
static int init_sess(struct rtrs_clt_sess *sess)
{
int err;
char str[NAME_MAX];
struct rtrs_addr path = {
.src = &sess->s.src_addr,
.dst = &sess->s.dst_addr,
};

rtrs_addr_to_str(&path, str, sizeof(str));

mutex_lock(&sess->init_mutex);
err = init_conns(sess);
if (err) {
char str[NAME_MAX];
int err;
struct rtrs_addr path = {
.src = &sess->s.src_addr,
.dst = &sess->s.dst_addr,
};

rtrs_addr_to_str(&path, str, sizeof(str));
rtrs_err(sess->clt,
"init_conns() failed: err=%d path=%s [%s:%u]\n", err,
str, sess->hca_name, sess->hca_port);
goto out;
}
err = rtrs_send_sess_info(sess);
if (err) {
char str[NAME_MAX];
int err;
struct rtrs_addr path = {
.src = &sess->s.src_addr,
.dst = &sess->s.dst_addr,
};

rtrs_addr_to_str(&path, str, sizeof(str));
rtrs_err(
sess->clt,
"rtrs_send_sess_info() failed: err=%d path=%s [%s:%u]\n",
Expand Down

0 comments on commit 7c71f0d

Please sign in to comment.