Commit 7c71f0d1 authored by Gioh Kim's avatar Gioh Kim Committed by Jason Gunthorpe

RDMA/rtrs-clt: Simplify error message

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.comSigned-off-by: default avatarGioh Kim <gi-oh.kim@ionos.com>
Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 42cdc190
...@@ -2522,18 +2522,17 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess *sess) ...@@ -2522,18 +2522,17 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess *sess)
static int init_sess(struct rtrs_clt_sess *sess) static int init_sess(struct rtrs_clt_sess *sess)
{ {
int err; int err;
mutex_lock(&sess->init_mutex);
err = init_conns(sess);
if (err) {
char str[NAME_MAX]; char str[NAME_MAX];
int err;
struct rtrs_addr path = { struct rtrs_addr path = {
.src = &sess->s.src_addr, .src = &sess->s.src_addr,
.dst = &sess->s.dst_addr, .dst = &sess->s.dst_addr,
}; };
rtrs_addr_to_str(&path, str, sizeof(str)); rtrs_addr_to_str(&path, str, sizeof(str));
mutex_lock(&sess->init_mutex);
err = init_conns(sess);
if (err) {
rtrs_err(sess->clt, rtrs_err(sess->clt,
"init_conns() failed: err=%d path=%s [%s:%u]\n", err, "init_conns() failed: err=%d path=%s [%s:%u]\n", err,
str, sess->hca_name, sess->hca_port); str, sess->hca_name, sess->hca_port);
...@@ -2541,14 +2540,6 @@ static int init_sess(struct rtrs_clt_sess *sess) ...@@ -2541,14 +2540,6 @@ static int init_sess(struct rtrs_clt_sess *sess)
} }
err = rtrs_send_sess_info(sess); err = rtrs_send_sess_info(sess);
if (err) { 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( rtrs_err(
sess->clt, sess->clt,
"rtrs_send_sess_info() failed: err=%d path=%s [%s:%u]\n", "rtrs_send_sess_info() failed: err=%d path=%s [%s:%u]\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment