[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220805053434.3944-1-liubo03@inspur.com>
Date: Fri, 5 Aug 2022 01:34:34 -0400
From: Bo Liu <liubo03@...pur.com>
To: <bvanassche@....org>, <jgg@...pe.ca>, <leon@...nel.org>
CC: <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Bo Liu <liubo03@...pur.com>
Subject: [PATCH] RDMA/srp: Check dev_set_name() return value
It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
Signed-off-by: Bo Liu <liubo03@...pur.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
Powered by blists - more mailing lists