This is a note to let you know that I've just added the patch titled RDMA/srp: Handle dev_set_name() failure to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: rdma-srp-handle-dev_set_name-failure.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit a5ca65ac73ce8f26ac5ce88364a2cab607e28625 Author: Bart Van Assche <bvanassche@xxxxxxx> Date: Thu Aug 25 14:38:59 2022 -0700 RDMA/srp: Handle dev_set_name() failure [ Upstream commit 351e458f725da8106eba920f3cdecf39a0e31136 ] 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@xxxxxxx Reported-by: Bo Liu <liubo03@xxxxxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx> Stable-dep-of: b05398aff9ad ("RDMA/srp: Support more than 255 rdma ports") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 1435d375a6ad..61b3fe4cc5e8 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3894,12 +3894,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;