mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid: Remove unnecessary assignment to variable ret
@ 2020-08-25  6:38 Jing Xiangfeng
  2020-08-25  7:01 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Jing Xiangfeng @ 2020-08-25  6:38 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara, jejb,
	martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi, linux-kernel, jingxiangfeng

The variable ret is being initialized with 'FAILED'. So we can remove
this assignement.

Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 0824410f78f8..96d424645b18 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -4700,7 +4700,6 @@ 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;
 	}
 
@@ -4713,7 +4712,6 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
 	}
 
 	if (!mr_device_priv_data->is_tm_capable) {
-		ret = FAILED;
 		goto out;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: megaraid: Remove unnecessary assignment to variable ret
  2020-08-25  6:38 [PATCH] scsi: megaraid: Remove unnecessary assignment to variable ret Jing Xiangfeng
@ 2020-08-25  7:01 ` Joe Perches
  2020-08-25  7:06   ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2020-08-25  7:01 UTC (permalink / raw)
  To: Jing Xiangfeng, kashyap.desai, sumit.saxena,
	shivasharan.srikanteshwara, jejb, martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi, linux-kernel

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;
 }
 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: megaraid: Remove unnecessary assignment to variable ret
  2020-08-25  7:01 ` Joe Perches
@ 2020-08-25  7:06   ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2020-08-25  7:06 UTC (permalink / raw)
  To: Jing Xiangfeng, kashyap.desai, sumit.saxena,
	shivasharan.srikanteshwara, jejb, martin.petersen
  Cc: linux-scsi, linux-kernel

On Tue, 2020-08-25 at 00:01 -0700, Joe Perches wrote:
> 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.

Looks like the megaraid mailing list is either subscribers-only
or doesn't exist anymore as my mail to it bounced.

One of the maintainers should remove it or update it.

Maybe:
---
diff --git a/MAINTAINERS b/MAINTAINERS
index ac79fdbdf8d0..0c181cd07201 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11060,7 +11060,7 @@ MEGARAID SCSI/SAS DRIVERS
 M:	Kashyap Desai <kashyap.desai@broadcom.com>
 M:	Sumit Saxena <sumit.saxena@broadcom.com>
 M:	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
-L:	megaraidlinux.pdl@broadcom.com
+L:	megaraidlinux.pdl@broadcom.com (subscribers-only)
 L:	linux-scsi@vger.kernel.org
 S:	Maintained
 W:	http://www.avagotech.com/support/



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-25  7:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25  6:38 [PATCH] scsi: megaraid: Remove unnecessary assignment to variable ret Jing Xiangfeng
2020-08-25  7:01 ` Joe Perches
2020-08-25  7:06   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®