lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e8d3765063043f7a90c92c098317319757595ed.camel@perches.com>
Date:   Tue, 25 Aug 2020 00:01:07 -0700
From:   Joe Perches <joe@...ches.com>
To:     Jing Xiangfeng <jingxiangfeng@...wei.com>,
        kashyap.desai@...adcom.com, sumit.saxena@...adcom.com,
        shivasharan.srikanteshwara@...adcom.com, jejb@...ux.ibm.com,
        martin.petersen@...cle.com
Cc:     megaraidlinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: megaraid: Remove unnecessary assignment to
 variable ret

On Tue, 2020-08-25 at 14:38 +0800, Jing Xiangfeng wrote:
> The variable ret is being initialized with 'FAILED'. So we can remove
> this assignement.

If you are going to change the code at all,
might as well try to improve it more by removing
the unnecessary out: label altogether.

Perhaps:
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 883cccb59c2d..1a8f18113136 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -4688,9 +4688,8 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd)
 
 int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
 {
-
 	struct megasas_instance *instance;
-	int ret = FAILED;
+	int ret;
 	u16 devhandle;
 	struct MR_PRIV_DEVICE *mr_device_priv_data;
 	mr_device_priv_data = scmd->device->hostdata;
@@ -4700,32 +4699,27 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
 	if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) {
 		dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL,"
 		"SCSI host:%d\n", instance->host->host_no);
-		ret = FAILED;
-		return ret;
+		return FAILED;
 	}
 
 	if (!mr_device_priv_data) {
 		sdev_printk(KERN_INFO, scmd->device,
 			    "device been deleted! scmd: (0x%p)\n", scmd);
 		scmd->result = DID_NO_CONNECT << 16;
-		ret = SUCCESS;
-		goto out;
+		return SUCCESS;
 	}
 
-	if (!mr_device_priv_data->is_tm_capable) {
-		ret = FAILED;
-		goto out;
-	}
+	if (!mr_device_priv_data->is_tm_capable)
+		return FAILED;
 
 	mutex_lock(&instance->reset_mutex);
 	devhandle = megasas_get_tm_devhandle(scmd->device);
 
 	if (devhandle == (u16)ULONG_MAX) {
-		ret = SUCCESS;
 		sdev_printk(KERN_INFO, scmd->device,
 			"target reset issued for invalid devhandle\n");
 		mutex_unlock(&instance->reset_mutex);
-		goto out;
+		return SUCCESS;
 	}
 
 	sdev_printk(KERN_INFO, scmd->device,
@@ -4741,7 +4735,6 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
 	scmd_printk(KERN_NOTICE, scmd, "target reset %s!!\n",
 		(ret == SUCCESS) ? "SUCCESS" : "FAILED");
 
-out:
 	return ret;
 }
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ