Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1947618pxy; Thu, 29 Apr 2021 19:24:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT2vBfRARiRGCrYOeyvilxFBk6FAYoumqzGujBYIZPKL4nHiWqR/joqXM+9KF1Bj7Cf/2H X-Received: by 2002:a17:906:33da:: with SMTP id w26mr1641361eja.472.1619749479662; Thu, 29 Apr 2021 19:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619749479; cv=none; d=google.com; s=arc-20160816; b=0e78L7zylZv9N045V8GaToL/rcUQdnu7PMU2JT4hEO5gPU32ISZTOfsDxgP5B664cB kVp6VAyNBG0jaS06VQPV7TUQRHa0kTDBOkQ5+wE/Lrvtw069tHcBU7/YFseUPJM0Rstf vjyEzcbipj5THa3l1KKBMAdx4lNfk3IDnVP0fMJ/+NcSrdUXvAHd6ErRCq6gIQRYHACN dhgHPJm50VN3aVVmpBrEHiI45QdukIBfT1MGfaG0vLeKcel2ATnVWcsOQnIon1sUI/ni mST9vnX3EZWm/WGMz4h32I0AGUZu6QJTuBZ9bBjVbyrC3/9vncZ7yfaVHFRF429W6WoJ micg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding:date :message-id:cc:to:from:sender:reply-to:subject:mime-version :dkim-signature:dkim-filter; bh=j4LWkwldRLUrGOZFZYtV8wATCeynPe4551DILqQur/4=; b=sPuW6fHAilmp06z+iY7F7MYmF+kb3KGpPXERa8n0CgqSj9mje9hUPEPy4kka1JBRIR UfdxQ41Me7nV0c+2cu3InNPVvGNIz69NWH47TBZS30K31EFZWKoTaej19IMokf8NSrXY wF6eUXZwMi1FtoAp1YoA/VCm7i6Aqe4SkWR9WOCVuxFvYke0C9JtKCqX9uBgeswF5zfp rDOF11kBV01gSgIAqOCcamfdkflQAdzzmM8xeWTULe0MLsPw+Y5Ecw4sA5keIwfSA11u b5veY2bjLjF2JJXCWvdZeOO/MWhzfJpPqzfBhj7Sri/UT1e+OCxLsfn9nU2qrVwAhhoV KQyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=KzV8x6qF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si1792131ejh.417.2021.04.29.19.24.15; Thu, 29 Apr 2021 19:24:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=KzV8x6qF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229912AbhD3CXx (ORCPT + 99 others); Thu, 29 Apr 2021 22:23:53 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:16621 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbhD3CXw (ORCPT ); Thu, 29 Apr 2021 22:23:52 -0400 Received: from epcas3p3.samsung.com (unknown [182.195.41.21]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210430022302epoutp010260362dea56d81ef464c8864df13225~6gXtI3LLV2528225282epoutp01l for ; Fri, 30 Apr 2021 02:23:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210430022302epoutp010260362dea56d81ef464c8864df13225~6gXtI3LLV2528225282epoutp01l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1619749382; bh=j4LWkwldRLUrGOZFZYtV8wATCeynPe4551DILqQur/4=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=KzV8x6qFK4eOk27ftngGS/MxvDWRnyXmeDdNSJEWoMbJ9dv2kOCWbfSwna+xohPve IG3tXir8u+FdmBdug2ZnmGlAOr4lcIzDcYmqu3CYX6zAIbxv3155xi3cMsPFQZEDol uGKYHcsaJZ0S2WqaPzZhAiIsazIy4wFTdtgg7pug= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas3p4.samsung.com (KnoxPortal) with ESMTP id 20210430022301epcas3p40a37b8920e942d2440983ff5a8aad732~6gXsi7Amt2702827028epcas3p4H; Fri, 30 Apr 2021 02:23:01 +0000 (GMT) Received: from epcpadp4 (unknown [182.195.40.18]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4FWbkY5Z1rz4x9Pv; Fri, 30 Apr 2021 02:23:01 +0000 (GMT) Mime-Version: 1.0 Subject: [PATCH] scsi: ufs: remove redundant initialization of variable Reply-To: keosung.park@samsung.com Sender: Keoseong Park From: Keoseong Park To: ALIM AKHTAR , "avri.altman@wdc.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "stanley.chu@mediatek.com" , "cang@codeaurora.org" , "beanhuo@micron.com" , "jaegeuk@kernel.org" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Daejun Park , Sung-Jun Park , Jinyoung CHOI X-Priority: 3 X-Content-Kind-Code: NORMAL X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <2038148563.21619749381770.JavaMail.epsvc@epcpadp4> Date: Fri, 30 Apr 2021 11:14:19 +0900 X-CMS-MailID: 20210430021419epcms2p402717e968615d301ba18341d28a828ee Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y X-Hop-Count: 3 X-CMS-RootMailID: 20210430021419epcms2p402717e968615d301ba18341d28a828ee References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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