summaryrefslogtreecommitdiff
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorGioh Kim <gi-oh.kim@cloud.ionos.com>2021-04-06 14:36:39 +0200
committerJason Gunthorpe <jgg@nvidia.com>2021-04-13 19:51:34 -0300
commit7c71f0d12eee4b7375e158dc11f8de6ffc524590 (patch)
tree4158be9ec0cbb368394c16fde0ade14c180ee467 /drivers/infiniband/ulp
parent42cdc1909d701d5dcd24c2a797b6331b7f30b5c6 (diff)
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.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>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/rtrs/rtrs-clt.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index dc2f73a8c7c6..5e94686bb22d 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2522,18 +2522,17 @@ out:
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);
@@ -2541,14 +2540,6 @@ static int init_sess(struct rtrs_clt_sess *sess)
}
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",