Skip to contentSkip to conversation

scsi: libsas: fix an error code in sas_ata_add_dev()

PATCH Applied Dan Carpenter 3 participants 3 messages Jan 5, 2023 – Jan 12, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: libsas: fix an error code in sas_ata_add_dev()

This code accidentally returns success instead of -ENOMEM.

Fixes 7cc7646b4b24 ("scsi: libsas: Factor out sas_ata_add_dev()")
---
 drivers/scsi/libsas/sas_ata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libsas/sas_ata.c +1 -1
index 177cdaef3cad..f5e1c24f54ca 100644
@@ -716,7 +716,7 @@ int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
 
 	rphy = sas_end_device_alloc(phy->port);
 	if (!rphy)
-		return ret;
+		return -ENOMEM;
 
 	rphy->identify.phy_identifier = phy_id;
 	child->rphy = rphy;
Signature · 1 line
2.35.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Dan Carpenter

This code accidentally returns success instead of -ENOMEM.

Fixes 7cc7646b4b24 ("scsi: libsas: Factor out sas_ata_add_dev()")
---
  drivers/scsi/libsas/sas_ata.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libsas/sas_ata.c +0 -0
index 177cdaef3cad..f5e1c24f54ca 100644

drivers/scsi/libsas/sas_ata.c int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy, · line 719

Quoted 5 lines
drivers/scsi/libsas/sas_ata.c +1 -1
@@ -716,7 +716,7 @@ int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
 
  	rphy = sas_end_device_alloc(phy->port);
  	if (!rphy)
-		return ret;
+		return -ENOMEM;

Hi Dan,

Good catch, thanks for the fix.

#2 lore raw
In reply to Dan Carpenter

Dan,

Quoted 1 line

This code accidentally returns success instead of -ENOMEM.

Applied to 6.3/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering