[PATCH] scsi: fcoe: Check dev_set_name() return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Bo Liu <liubo03@xxxxxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux