From patchwork Fri Nov 11 06:23:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Lee X-Patchwork-Id: 624175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B279CC4332F for ; Fri, 11 Nov 2022 06:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233064AbiKKGcy (ORCPT ); Fri, 11 Nov 2022 01:32:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233270AbiKKGcT (ORCPT ); Fri, 11 Nov 2022 01:32:19 -0500 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA34CF587 for ; Thu, 10 Nov 2022 22:31:06 -0800 (PST) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20221111062329epoutp020d1752b687ed7c6bfa5f8a4914831a9b~mc5hHj8L11788017880epoutp02f for ; Fri, 11 Nov 2022 06:23:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20221111062329epoutp020d1752b687ed7c6bfa5f8a4914831a9b~mc5hHj8L11788017880epoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1668147809; bh=3xPjjXI1Nb04Dpddz4+jF2hh7bD+qn5TBdH/kS2axg0=; h=From:To:Cc:Subject:Date:References:From; b=tKrG5Atkf/NoxBiwoX3Cx+Npi8oZoG7gR6JiZfPdtkZYc318dqFYD1QfNufBAzIQP Z0ddWuyro4feTnKrVjMK7qwz6T2AN6Bg878Gr+02mOpm44UPsDVW0/v8QcD+eCyTdM A353vyJQQEF1D/PG/xNc3h6ufRvMRF5wAFhveF7s= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20221111062329epcas1p3289590811e544a38d364e1c95840237d~mc5gokm0x0729907299epcas1p3K; Fri, 11 Nov 2022 06:23:29 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.38.250]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4N7pYY1kF0z4x9Q2; Fri, 11 Nov 2022 06:23:29 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id C6.31.51827.16AED636; Fri, 11 Nov 2022 15:23:29 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20221111062328epcas1p2c2d1f52fed1068579a1dad7fb4e60f52~mc5gQubZ01221612216epcas1p2H; Fri, 11 Nov 2022 06:23:28 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221111062328epsmtrp2b40ed3b0f2a878bcb041d4a12a51c83c~mc5gQEdp62943729437epsmtrp2A; Fri, 11 Nov 2022 06:23:28 +0000 (GMT) X-AuditID: b6c32a36-17bfa7000000ca73-4f-636dea6145d1 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 8E.7E.18644.06AED636; Fri, 11 Nov 2022 15:23:28 +0900 (KST) Received: from localhost.localdomain (unknown [10.253.100.232]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221111062328epsmtip13743b0a647dd20191b444d2af948d48e~mc5gCPuXM1147511475epsmtip1W; Fri, 11 Nov 2022 06:23:28 +0000 (GMT) From: Chanwoo Lee To: alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ChanWoo Lee Subject: [PATCH] scsi: ufs: core: Fix unnecessary operation for early return Date: Fri, 11 Nov 2022 15:23:01 +0900 Message-Id: <20221111062301.7423-1-cw9316.lee@samsung.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCJsWRmVeSWpSXmKPExsWy7bCmnm7iq9xkgwlHuS0ezNvGZvHy51U2 i4MPO1kspn34yWwx41Qbq8WiG9uYLC7vmsNm0X19B5vF8uP/mBw4PS5f8faYsOgAo8f39R1s Hh+f3mLx6NuyitHj8yY5j/YD3UwB7FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaW FuZKCnmJuam2Si4+AbpumTlAlykplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswK 9IoTc4tL89L18lJLrAwNDIxMgQoTsjOapl1gL5jEWdF5M7iB8Sh7FyMnh4SAicT2XR+AbC4O IYEdjBIrt9xjhnA+MUr8mrWSDcL5zCjRuGA7M0zL/MnroBK7GCUWzpvCCuF8YZTY9m8JUIaD g01AS+L2MW+QuIjAMUaJD2/OM4F0MwtoSJyc9QRsubCAj8TftleMIDaLgKrEuy0vwTbwClhJ dLy7wgSxTV7iz/0eqLigxMmZT1gg5shLNG+dDXarhMAjdom7p49DNbhInJu/jA3CFpZ4dXwL 1KdSEp/f7WWDaGgGuvTrJSYIp4NRYmPrC0aIKmOJT58/M4K8wCygKbF+lz5EWFFi5++5jBCb +STefe1hBSmREOCV6GgTgihRkZjTdY4NZtfHG49ZIWwPifU3F4LdICQQK/Fz9zfWCYzys5D8 MwvJP7MQFi9gZF7FKJZaUJybnlpsWGAEj9bk/NxNjODkqWW2g3HS2w96hxiZOBgPMUpwMCuJ 8HJrZCcL8aYkVlalFuXHF5XmpB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N3R9vGy1d7J3y2ndpY+uTGSd6c2mPM jNmqq8UWlfbdne8a+qP4+f1vJ3X5uOYUa2f9fNZn0vxxR/RWPce1EULGx+pmiF3YsEc4Veul UWRYqE6Bcs6jHE7B1clpp7a5XBJettVW8Ibq5qRHTL6rtwSEhxxZHi9rflQ1f1bWGaWpcSev eTNabgt35PtenGRVknT11IwSNy/75l2H7r+Qcy6T8Vp3Vzfp7HUNezX9hpi81WIzt16x2Kf1 YLshj+LvxIbmR/zOPNFd9tfMSoN48/kOXo3LEmX6eGqarRJLcUaioRZzUXEiABaA9cnTAgAA X-CMS-MailID: 20221111062328epcas1p2c2d1f52fed1068579a1dad7fb4e60f52 X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221111062328epcas1p2c2d1f52fed1068579a1dad7fb4e60f52 References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: ChanWoo Lee For early return, bitmap_len operation is not required. Modified to reduce unnecessary operations. Signed-off-by: ChanWoo Lee --- drivers/ufs/core/ufshpb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/ufs/core/ufshpb.c b/drivers/ufs/core/ufshpb.c index 148017b2dfeb..994f4ac9df5a 100644 --- a/drivers/ufs/core/ufshpb.c +++ b/drivers/ufs/core/ufshpb.c @@ -233,11 +233,6 @@ static bool ufshpb_test_ppn_dirty(struct ufshpb_lu *hpb, int rgn_idx, rgn = hpb->rgn_tbl + rgn_idx; srgn = rgn->srgn_tbl + srgn_idx; - if (likely(!srgn->is_last)) - bitmap_len = hpb->entries_per_srgn; - else - bitmap_len = hpb->last_srgn_entries; - if (!ufshpb_is_valid_srgn(rgn, srgn)) return true; @@ -253,6 +248,11 @@ static bool ufshpb_test_ppn_dirty(struct ufshpb_lu *hpb, int rgn_idx, return true; } + if (likely(!srgn->is_last)) + bitmap_len = hpb->entries_per_srgn; + else + bitmap_len = hpb->last_srgn_entries; + if ((srgn_offset + cnt) > bitmap_len) bit_len = bitmap_len - srgn_offset; else