All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: fcoe: Check dev_set_name() return value
@ 2022-07-08  2:50 Bo Liu
  0 siblings, 0 replies; only message in thread
From: Bo Liu @ 2022-07-08  2:50 UTC (permalink / raw)
  To: hare, jejb, martin.petersen; +Cc: linux-scsi, 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/scsi/fcoe/fcoe_sysfs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index af658aa38fed..4da331cfc108 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -828,7 +828,10 @@ struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,
 	if (!ctlr->devloss_work_q)
 		goto out_del_q;
 
-	dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id);
+	error = dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id);
+	if (error)
+		goto out_del_q2;
+
 	error = device_register(&ctlr->dev);
 	if (error)
 		goto out_del_q2;
@@ -1024,7 +1027,9 @@ struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr,
 
 	fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo;
 
-	dev_set_name(&fcf->dev, "fcf_%d", fcf->id);
+	error = dev_set_name(&fcf->dev, "fcf_%d", fcf->id);
+	if (error)
+		goto out_del;
 
 	fcf->fabric_name = new_fcf->fabric_name;
 	fcf->switch_name = new_fcf->switch_name;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-08  2:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08  2:50 [PATCH] scsi: fcoe: Check dev_set_name() return value Bo Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.