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>] [day] [month] [year] [list]
Message-ID: <20251020070407.245889-1-yili@winhong.com>
Date: Mon, 20 Oct 2025 15:04:07 +0800
From: yili <yili@...hong.com>
To: linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	yili@...hong.com
Cc: megaraidlinux.pdl@...adcom.com,
	kashyap.desai@...adcom.com,
	sumit.saxena@...adcom.com,
	shivasharan.srikanteshwara@...adcom.com,
	chandrakanth.patil@...adcom.com
Subject: [PATCH] scsi: megaraid_sas: Use local scmd_local variable consistently

From: Yi Li <yili@...hong.com>

This is a code refactoring patch that replaces multiple instances of
'cmd_fusion->scmd' with the local variable 'scmd_local' in two functions:

The changes improve code consistency and maintainability by using the
already available local variable instead of repeatedly dereferencing
the command structure. No functional changes are introduced.

Signed-off-by: Yi Li <yili@...hong.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index a6794f49e9fa..76120e9cdd89 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3616,12 +3616,12 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
 		case MPI2_FUNCTION_SCSI_IO_REQUEST:  /*Fast Path IO.*/
 			/* Update load balancing info */
 			if (fusion->load_balance_info &&
-			    (megasas_priv(cmd_fusion->scmd)->status &
+			    (megasas_priv(scmd_local)->status &
 			    MEGASAS_LOAD_BALANCE_FLAG)) {
 				device_id = MEGASAS_DEV_INDEX(scmd_local);
 				lbinfo = &fusion->load_balance_info[device_id];
 				atomic_dec(&lbinfo->scsi_pending_cmds[cmd_fusion->pd_r1_lb]);
-				megasas_priv(cmd_fusion->scmd)->status &=
+				megasas_priv(scmd_local)->status &=
 					~MEGASAS_LOAD_BALANCE_FLAG;
 			}
 			fallthrough;	/* and complete IO */
@@ -5000,12 +5000,12 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 				megasas_return_cmd_fusion(instance, r1_cmd);
 			}
 			scmd_local = cmd_fusion->scmd;
-			if (cmd_fusion->scmd) {
+			if (scmd_local) {
 				if (megasas_dbg_lvl & OCR_DEBUG) {
 					sdev_printk(KERN_INFO,
-						cmd_fusion->scmd->device, "SMID: 0x%x\n",
+						scmd_local->device, "SMID: 0x%x\n",
 						cmd_fusion->index);
-					megasas_dump_fusion_io(cmd_fusion->scmd);
+					megasas_dump_fusion_io(scmd_local);
 				}
 
 				if (cmd_fusion->io_request->Function ==
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ