summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-08-25 23:38:59 +0200
committerLeon Romanovsky <leonro@nvidia.com>2022-08-28 12:02:20 +0200
commit351e458f725da8106eba920f3cdecf39a0e31136 (patch)
treeff30176db578f4495d113a37fc6ea0d88ee81760 /drivers
parentRDMA/srp: Remove the srp_host.released completion (diff)
downloadlinux-351e458f725da8106eba920f3cdecf39a0e31136.tar.xz
linux-351e458f725da8106eba920f3cdecf39a0e31136.zip
RDMA/srp: Handle dev_set_name() failure
Instead of ignoring dev_set_name() failure, handle dev_set_name() failure. Convert a device_register() call into device_initialize() and device_add() calls. Link: https://lore.kernel.org/r/20220825213900.864587-4-bvanassche@acm.org Reported-by: Bo Liu <liubo03@inspur.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 1d3a15e63732..3f31a0eef1ef 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3902,12 +3902,13 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
host->srp_dev = device;
host->port = port;
+ device_initialize(&host->dev);
host->dev.class = &srp_class;
host->dev.parent = device->dev->dev.parent;
- dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
- port);
-
- if (device_register(&host->dev))
+ if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
+ port))
+ goto put_host;
+ if (device_add(&host->dev))
goto put_host;
if (device_create_file(&host->dev, &dev_attr_add_target))
goto put_host;