diff mbox series

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

Message ID Y7asLxzVwQ56G+ya@kili
State New
Headers show
Series scsi: libsas: fix an error code in sas_ata_add_dev() | expand

Commit Message

kernel test robot Jan. 5, 2023, 10:53 a.m. UTC
This code accidentally returns success instead of -ENOMEM.

Fixes: 7cc7646b4b24 ("scsi: libsas: Factor out sas_ata_add_dev()")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/scsi/libsas/sas_ata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Yan Jan. 5, 2023, 11:28 a.m. UTC | #1
On 2023/1/5 18:53, Dan Carpenter wrote:
> This code accidentally returns success instead of -ENOMEM.
> 
> Fixes: 7cc7646b4b24 ("scsi: libsas: Factor out sas_ata_add_dev()")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>   drivers/scsi/libsas/sas_ata.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index 177cdaef3cad..f5e1c24f54ca 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -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.

Reviewed-by: Jason Yan <yanaijie@huawei.com>
Martin K. Petersen Jan. 12, 2023, 4:34 a.m. UTC | #2
Dan,

> This code accidentally returns success instead of -ENOMEM.

Applied to 6.3/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 177cdaef3cad..f5e1c24f54ca 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -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;