All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keoseong Park <keosung.park@samsung.com>
To: ALIM AKHTAR <alim.akhtar@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"cang@codeaurora.org" <cang@codeaurora.org>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"jaegeuk@kernel.org" <jaegeuk@kernel.org>,
	"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Daejun Park <daejun7.park@samsung.com>,
	Sung-Jun Park <sungjun07.park@samsung.com>,
	Jinyoung CHOI <j-young.choi@samsung.com>
Subject: [PATCH] scsi: ufs: remove redundant initialization of variable
Date: Fri, 30 Apr 2021 11:14:19 +0900	[thread overview]
Message-ID: <2038148563.21619749381770.JavaMail.epsvc@epcpadp4> (raw)
In-Reply-To: CGME20210430021419epcms2p402717e968615d301ba18341d28a828ee@epcms2p4

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@samsung.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

       reply	other threads:[~2021-04-30  2:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210430021419epcms2p402717e968615d301ba18341d28a828ee@epcms2p4>
2021-04-30  2:14 ` Keoseong Park [this message]
2021-04-30  8:47   ` [PATCH] scsi: ufs: remove redundant initialization of variable Bean Huo
2021-05-07  3:05     ` Keoseong Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2038148563.21619749381770.JavaMail.epsvc@epcpadp4 \
    --to=keosung.park@samsung.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=cang@codeaurora.org \
    --cc=daejun7.park@samsung.com \
    --cc=j-young.choi@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stanley.chu@mediatek.com \
    --cc=sungjun07.park@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.