Message ID | 20230502113116epcms2p7b83da0d683e29f667c38f5430b985388@epcms2p7 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp557447vqo; Tue, 2 May 2023 05:10:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7gfzrqV0H0jeyg8DVFgy3kaErYWkSWxn+jPSxNKZAwEcCnYdIn1E1YbCQNmYM3efi/ckqm X-Received: by 2002:a05:6a00:190a:b0:63d:2910:5c8b with SMTP id y10-20020a056a00190a00b0063d29105c8bmr22369636pfi.29.1683029402446; Tue, 02 May 2023 05:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683029402; cv=none; d=google.com; s=arc-20160816; b=yXmTJDVJYCRyzMYyw+egyoy09zFo2QqCG8a9l2l3zoNDsfd5YltQzuAHDfdvrQpcyA diJX88oqpZTw1s1R9us4HPeERbRK9N1uchjt+MVKinwJFdZ9GL7ox1kjx6XbpK0gPQcs 5fIWBPP3xkofGYBaRvv6Z0ZkdYoo0E1cEtSFxHg83uTIR3GEqRSIBXVb5uVa5rq02V02 RzmA+p30P1lWLdhzSvw4Fuapo5e0z1gYKotYvJlECHg+sXpqcSvwQ1n/BDDPDWPjz417 T8c9WSMMna1e6mLxVVAVdGlY8oJvFUMUJawsmAizR7oVyexbKVBwXn2lQn+naIFkttpk J+fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:to:from:sender:reply-to :subject:mime-version:dkim-signature:dkim-filter; bh=xmiMWORcrOAQxNE1CAsFrz5Kae9r4tZ/FFzkcGFfdC0=; b=aTtixYMuQWz53mYMrhsbTDNmYXeO2k78D1gCRf2VQd7SBxjTF5NVaZ6M1g8kP85DD7 OJivjGUvwLlv6QJpGGcWIu7vQyK+Nuhr46rLjLQtFbt6GvtMPS68x3ibyizA/3pScDBH LhBGUU9Cfeo1aY99DSCECP/V/l+4zyaZl3/eHduTjuwuT17DysU31yh1i/xAto5QVFCn uC1VLTHW9Jc1jOtFx5k7Zh5R/0xOFsD+oIrF0zbiQjged3DQwUwlQjyU5Eh18DPxnp0X vmqEdIOe55ARwy0ttRqUhEwgzTvIpTM8FeOqqh/udMy4FwNrDcmQZGAXfKU2sZgRNq8E T6Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Lus+BKz2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a656681000000b0050c0a7a2742si31133166pgw.350.2023.05.02.05.09.49; Tue, 02 May 2023 05:10:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Lus+BKz2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234038AbjEBLcJ (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 2 May 2023 07:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233731AbjEBLcH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 2 May 2023 07:32:07 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4605B96 for <linux-kernel@vger.kernel.org>; Tue, 2 May 2023 04:31:43 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230502113118epoutp01658df92c7d71d7f7f4767ffbafe442b2~bUDXeFlXc1163111631epoutp01H for <linux-kernel@vger.kernel.org>; Tue, 2 May 2023 11:31:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230502113118epoutp01658df92c7d71d7f7f4767ffbafe442b2~bUDXeFlXc1163111631epoutp01H 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 <keosung.park@samsung.com> From: Keoseong Park <keosung.park@samsung.com> To: ALIM AKHTAR <alim.akhtar@samsung.com>, "avri.altman@wdc.com" <avri.altman@wdc.com>, "bvanassche@acm.org" <bvanassche@acm.org>, "jejb@linux.ibm.com" <jejb@linux.ibm.com>, "martin.petersen@oracle.com" <martin.petersen@oracle.com>, "stanley.chu@mediatek.com" <stanley.chu@mediatek.com>, "mani@kernel.org" <mani@kernel.org>, "quic_asutoshd@quicinc.com" <quic_asutoshd@quicinc.com>, "beanhuo@micron.com" <beanhuo@micron.com>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "linux-kernel@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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmqW7Ll4AUg6WTDS0ezNvGZvHy51U2 i4MPO1kspn34yWzx8pCmxaPbzxgtFt3YxmRxedccNovu6zvYLA58WMVosfz4PyaLhR1zWSyW br3J6MDrcfmKt8emVZ1sHhMWHWD0aDm5n8Xj+/oONo+PT2+xeEzcU+fRt2UVo8fnTXIe7Qe6 mQK4orJtMlITU1KLFFLzkvNTMvPSbZW8g+Od403NDAx1DS0tzJUU8h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ootMailID: 20230502113116epcms2p7b83da0d683e29f667c38f5430b985388 References: <CGME20230502113116epcms2p7b83da0d683e29f667c38f5430b985388@epcms2p7> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764784238372378410?= X-GMAIL-MSGID: =?utf-8?q?1764784238372378410?= |
Series |
scsi: ufs: core: Use readable 'return 0' in ufshcd_hba_capabilities()
|
|
Commit Message
Keoseong Park
May 2, 2023, 11:31 a.m. UTC
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 <keosung.park@samsung.com>
---
drivers/ufs/core/ufshcd.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On 5/2/23 04:31, Keoseong Park wrote: > 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 <keosung.park@samsung.com> > --- > 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; > } The most important change in this patch is that ufshcd_hba_capabilities() returns earlier if ufshcd_hba_init_crypto_capabilities() fails. Please change the patch title such that it reflects this change instead of the other less important change. Thanks, Bart.
>On 5/2/23 04:31, Keoseong Park wrote: >> 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 <keosung.park@samsung.com> >> --- >> 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; >> } > >The most important change in this patch is that ufshcd_hba_capabilities() >returns earlier if ufshcd_hba_init_crypto_capabilities() fails. Please >change the patch title such that it reflects this change instead of the >other less important change. OK, I will change it. Best Regards, Keoseong > >Thanks, > >Bart.
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; } /**