mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RDMA/srp: Check dev_set_name() return value
@ 2022-08-05  5:34 Bo Liu
  2022-08-05 13:57 ` Bart Van Assche
  2022-08-05 14:02 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Bo Liu @ 2022-08-05  5:34 UTC (permalink / raw)
  To: bvanassche, jgg, leon; +Cc: linux-rdma, linux-kernel, Bo Liu

It's possible that dev_set_name() returns -ENOMEM, catch and handle this.

Signed-off-by: Bo Liu <liubo03@inspur.com>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 7720ea270ed8..a6f788e3b84b 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3905,8 +3905,9 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
 
 	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 (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
+		     port))
+		goto free_host;
 
 	if (device_register(&host->dev))
 		goto free_host;
-- 
2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-05 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05  5:34 [PATCH] RDMA/srp: Check dev_set_name() return value Bo Liu
2022-08-05 13:57 ` Bart Van Assche
2022-08-05 14:02 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®