From patchwork Tue May 2 11:31:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keoseong Park X-Patchwork-Id: 13228812 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 3D3FEC77B73 for ; Tue, 2 May 2023 11:41:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234023AbjEBLlb (ORCPT ); Tue, 2 May 2023 07:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234032AbjEBLl3 (ORCPT ); Tue, 2 May 2023 07:41:29 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA0B4C2D for ; Tue, 2 May 2023 04:41:13 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230502113118epoutp01604cfe479a94474bce0eff5d8498c4c2~bUDXdj3g01134311343epoutp01k for ; Tue, 2 May 2023 11:31:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230502113118epoutp01604cfe479a94474bce0eff5d8498c4c2~bUDXdj3g01134311343epoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683027078; bh=xmiMWORcrOAQxNE1CAsFrz5Kae9r4tZ/FFzkcGFfdC0=; h=Subject:Reply-To:From:To:Date:References:From; b=Lus+BKz2FMRCNma36805QyV7fTskm4DQfG6SWoXiJ5qY09kLcbd8jDENB0zK8DKEx bTYMHpxjTNUQ22ojXNL3nfNiEAwpTCxC4psVMhJHKWP2DDwg1abHTb40DMBBDUNq+K MtCZbbjna42OOtiJKPy1iL05/HfqK8UxeilQ1z68= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230502113117epcas2p1e97a512ba73df6dd2165af28259e1979~bUDXD4WrM0355803558epcas2p1D; Tue, 2 May 2023 11:31:17 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.91]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Q9dFJ6Gjgz4x9Pp; Tue, 2 May 2023 11:31:16 +0000 (GMT) X-AuditID: b6c32a46-8b7ff7000001438d-69-6450f484f687 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id FE.5E.17293.484F0546; Tue, 2 May 2023 20:31:16 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH] scsi: ufs: core: Use readable 'return 0' in ufshcd_hba_capabilities() Reply-To: keosung.park@samsung.com Sender: Keoseong Park From: Keoseong Park To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "stanley.chu@mediatek.com" , "mani@kernel.org" , "quic_asutoshd@quicinc.com" , "beanhuo@micron.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" 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: <20230502113116epcms2p7b83da0d683e29f667c38f5430b985388@epcms2p7> Date: Tue, 02 May 2023 20:31:16 +0900 X-CMS-MailID: 20230502113116epcms2p7b83da0d683e29f667c38f5430b985388 X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmK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MvUXsZW5Za8r9bo0YVZNQdZ5lY8PXUxtvS9 3dL/RhcdXdyuvilm2+3GsTZ8+76kR2EXMm11bjBrKbvJTftUfJV920qvl6/npXo6PRMUq2ir S0ve4fPmv0iAZMpMc749Vr0Pj60/6MsuEib6cD1r4NMTtwK92RlMzW5fcNT9JmBuLK3EUpyR aKjFXFScCACdAcKtTQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230502113116epcms2p7b83da0d683e29f667c38f5430b985388 References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The 'err' variable is the result of ufshcd_hba_init_crypto_capabilities() regardless of MCQ capabilities. Return 'err' immediately when the function error occurs. And if it is not an error, explicitly return 0. Anyway, if ufshcd_hba_init_crypto_capabilities() returns error, MCQ capabilities is not used because it fails to initialize UFS driver. Signed-off-by: Keoseong Park --- drivers/ufs/core/ufshcd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9434328ba323..44328eb4158d 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2343,18 +2343,20 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) /* Read crypto capabilities */ err = ufshcd_hba_init_crypto_capabilities(hba); - if (err) + if (err) { dev_err(hba->dev, "crypto setup failed\n"); + return err; + } hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities); if (!hba->mcq_sup) - return err; + return 0; hba->mcq_capabilities = ufshcd_readl(hba, REG_MCQCAP); hba->ext_iid_sup = FIELD_GET(MASK_EXT_IID_SUPPORT, hba->mcq_capabilities); - return err; + return 0; } /**