diff options
Diffstat (limited to 'drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c')
-rw-r--r-- | drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c index 126a96e75c62..a9288175fbb5 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c @@ -176,7 +176,8 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) err = device_add(&srv->dev); if (err) { pr_err("device_add(): %d\n", err); - goto put; + put_device(&srv->dev); + goto unlock; } srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj); if (!srv->kobj_paths) { @@ -188,10 +189,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) } dev_set_uevent_suppress(&srv->dev, false); kobject_uevent(&srv->dev.kobj, KOBJ_ADD); - goto unlock; - -put: - put_device(&srv->dev); unlock: mutex_unlock(&srv->paths_mutex); @@ -262,14 +259,13 @@ int rtrs_srv_create_sess_files(struct rtrs_srv_sess *sess) struct rtrs_srv *srv = sess->srv; struct rtrs_sess *s = &sess->s; char str[NAME_MAX]; - int err, cnt; - - cnt = sockaddr_to_str((struct sockaddr *)&sess->s.dst_addr, - str, sizeof(str)); - cnt += scnprintf(str + cnt, sizeof(str) - cnt, "@"); - sockaddr_to_str((struct sockaddr *)&sess->s.src_addr, - str + cnt, sizeof(str) - cnt); + int err; + struct rtrs_addr path = { + .src = &sess->s.dst_addr, + .dst = &sess->s.src_addr, + }; + rtrs_addr_to_str(&path, str, sizeof(str)); err = rtrs_srv_create_once_sysfs_root_folders(sess); if (err) return err; |