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-next>] [day] [month] [year] [list]
Message-ID: <2038148563.21619749381770.JavaMail.epsvc@epcpadp4>
Date:   Fri, 30 Apr 2021 11:14:19 +0900
From:   Keoseong Park <keosung.park@...sung.com>
To:     ALIM AKHTAR <alim.akhtar@...sung.com>,
        "avri.altman@....com" <avri.altman@....com>,
        "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
        "cang@...eaurora.org" <cang@...eaurora.org>,
        "beanhuo@...ron.com" <beanhuo@...ron.com>,
        "jaegeuk@...nel.org" <jaegeuk@...nel.org>,
        "adrian.hunter@...el.com" <adrian.hunter@...el.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Daejun Park <daejun7.park@...sung.com>,
        Sung-Jun Park <sungjun07.park@...sung.com>,
        Jinyoung CHOI <j-young.choi@...sung.com>
Subject: [PATCH] scsi: ufs: remove redundant initialization of variable

The variable d_lu_wb_buf_alloc may be repeatedly initialized to 0 in a for-loop.
If the variable is set to a value other than 0, it exits the for-loop, so there is no need to reset it to 0.

Since lun and d_lu_wb_buf_alloc are just being used in a else statement inside a local scope, move the declaration of the variables to that scope.

Signed-off-by: Keoseong Park <keosung.park@...sung.com>
---
 drivers/scsi/ufs/ufshcd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 0625da7a42ee..77cc473961a2 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7277,8 +7277,6 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
 static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf)
 {
 	struct ufs_dev_info *dev_info = &hba->dev_info;
-	u8 lun;
-	u32 d_lu_wb_buf_alloc;
 	u32 ext_ufs_feature;
 
 	if (!ufshcd_is_wb_allowed(hba))
@@ -7318,8 +7316,10 @@ static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf)
 				   DEVICE_DESC_PARAM_WB_SHARED_ALLOC_UNITS))
 			goto wb_disabled;
 	} else {
+		u8 lun;
+		u32 d_lu_wb_buf_alloc = 0;
+
 		for (lun = 0; lun < UFS_UPIU_MAX_WB_LUN_ID; lun++) {
-			d_lu_wb_buf_alloc = 0;
 			ufshcd_read_unit_desc_param(hba,
 					lun,
 					UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS,
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ