Message ID | 20231213022500.9011-1-cw9316.lee@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp8135861vqy; Tue, 12 Dec 2023 18:26:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxTq1FGHAOTJQvjbTv9rT/jdSydy+cj0hvTDkgbV8BcPEFwbsEbF89NL7qXAARhY3y2WZE X-Received: by 2002:a05:6870:1615:b0:1fb:75b:2fd6 with SMTP id b21-20020a056870161500b001fb075b2fd6mr8487293oae.109.1702434371286; Tue, 12 Dec 2023 18:26:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702434371; cv=none; d=google.com; s=arc-20160816; b=AGLkfyBGJzfP0jE/7kzGW/NtXuOEBIu02w0+2kUzAM1GkFRbAdGLcwNWs/jMK9O4bK AO6sNn+74cm4FLfJtH2iM2YK9wuMX69Z3zTn2+jqocQugIBze/h/z0IwQ29SgUlYzvE0 QdvUU+nvzehdWPxQUjsI0bK4S1N0Wya+XAZSKNn3icvQa5wEv90Rvqjg95YHKwq0dVdG R8B9g8zLeFi/Kz64RUfdcSopcUc9rbYQyo4g1Sj+KHJkNMNvnDW23ZQB1CgqHyDgGCJ/ fvXuvbyu9/ViBpJ3Wy+2HU16tUVZahFptlFyNGphgV41EWxnwp9cC+RUK2MV+qMqs8VW JTzw== 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:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=llvFRz0oCIQGbziuHlF3lamYUb4g/Mx7VDSl7Hr2w70=; fh=JCubvaja2uLtLpPVhDOPh0Ur1N78sk9qUDnfReS3W/g=; b=bdtWyO8NwMHR7eBUFLaL5ZHhgvkCSSl8S/l/zAG5k83Y1ZJ4gx8yaHGL1/Mwt9TCFr f/FAzvjlXhTWjnxNLl+xMGA+gK7hswio30JDmysBw58fJX2Wt3a1pGo/ctykhqJLg6up DDFPE7xGIVctnYBSr9kXphJpF4N9uvJRdEhA8Sz545IoR6srN130/JDjt4RJCwnhGxiW vNXIN4ir5+LxZrbs6Q1Pqt/zJUEsox3C0S3xvrK6v1OBXtPWokg6lHusHn5sHhgWftKc Xtj1gjlA/jT1dC3tzL+Yd7sMG6HlcQE6hOoX6/BZmOnPj3JDSSiTDUuKhuBcIx6xt257 93bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MREF7QEX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m10-20020a63ed4a000000b005bdbdd396eesi8703880pgk.633.2023.12.12.18.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 18:26:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MREF7QEX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E85D581CB0EB; Tue, 12 Dec 2023 18:26:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378335AbjLMCZb (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 21:25:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378305AbjLMCZ1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 21:25:27 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10C7AA6 for <linux-kernel@vger.kernel.org>; Tue, 12 Dec 2023 18:25:31 -0800 (PST) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20231213022527epoutp04289413997050434965bb46a3abcf5046~gQwA78Ndw1937919379epoutp04d for <linux-kernel@vger.kernel.org>; Wed, 13 Dec 2023 02:25:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20231213022527epoutp04289413997050434965bb46a3abcf5046~gQwA78Ndw1937919379epoutp04d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1702434327; bh=llvFRz0oCIQGbziuHlF3lamYUb4g/Mx7VDSl7Hr2w70=; h=From:To:Cc:Subject:Date:References:From; b=MREF7QEXKe+dQZ+lY1apYWdgC1csNidjjpTUwXMhX0irDESLtcqQrYmeHkRW8gJU4 yTSSXcfmrnAIX0xsH8g9ctcoYP5ZRBHnvcKAuUrMegg141wB3MUaZmxaxWGOFVbvb9 UYKfruGoJpFrwqVC0Z+jstWRx/1+2UGkcW4gfQWU= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20231213022526epcas1p2768b522dbed430c04325c5b3cbf83748~gQwAMzc1f2140721407epcas1p2U; Wed, 13 Dec 2023 02:25:26 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.36.222]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4SqfTf1kQzz4x9Px; Wed, 13 Dec 2023 02:25:26 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id C0.46.09744.61619756; Wed, 13 Dec 2023 11:25:26 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231213022525epcas1p219483a7572a12394c5852cd53a367da4~gQv-VaPJX2004720047epcas1p2x; Wed, 13 Dec 2023 02:25:25 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231213022525epsmtrp16b95d43d02cf2ec71c1652b30a3c6ee1~gQv-UfYN22117621176epsmtrp1m; Wed, 13 Dec 2023 02:25:25 +0000 (GMT) X-AuditID: b6c32a35-107fa70000002610-2a-657916166080 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id FD.34.08755.51619756; Wed, 13 Dec 2023 11:25:25 +0900 (KST) Received: from localhost.localdomain (unknown [10.253.100.232]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231213022525epsmtip24ac15f90dc60a39a5845e2e7522a8a28~gQv-E9HGZ0163101631epsmtip27; Wed, 13 Dec 2023 02:25:25 +0000 (GMT) From: Chanwoo Lee <cw9316.lee@samsung.com> To: mani@kernel.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, jejb@linux.ibm.com, martin.petersen@oracle.com, p.zabel@pengutronix.de, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: grant.jung@samsung.com, jt77.jang@samsung.com, dh0421.hwang@samsung.com, sh043.lee@samsung.com, ChanWoo Lee <cw9316.lee@samsung.com> Subject: [PATCH] scsi: ufs: qcom: Re-fix for error handling Date: Wed, 13 Dec 2023 11:25:00 +0900 Message-Id: <20231213022500.9011-1-cw9316.lee@samsung.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEJsWRmVeSWpSXmKPExsWy7bCmrq6YWGWqQccmbotzj3+zWGzrsLGY caqN1WLftZPsFr/+rme3WHRjG5PFjudn2C06Jm9nsZi4/yy7xeVdc9gsuq/vYLM48GEVo8Xy 4/+YLO7eO8Fi0fRnH4sDv8emVZ1sHneu7WHzmLDoAKPHx6e3WDz6/xp49G1ZxejxeZNcAHtU tk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0NlKCmWJ OaVAoYDE4mIlfTubovzSklSFjPziElul1IKUnAKzAr3ixNzi0rx0vbzUEitDAwMjU6DChOyM tgXnWAue8lcsbJzB1MD4naeLkZNDQsBE4vShq8wgtpDADkaJ/y8luxi5gOxPjBL717UyQzjf GCWe/drHDNPxc1cnG0RiL6PE5nMLoZwvjBIrP58Hcjg42AS0JG4f8waJiwj8ZZRYfKaLEcRh FuhilPh1sIsFZJSwgLXEjLdr2UBsFgFViZYPjxlBbF4BK4l53x9CrZOX+HO/hxkiLihxcuYT sF5moHjz1tlg90kIzOSQ2N90mR2iwUXi3qMnbBC2sMSr41ug4lISL/vb2CEamhklFr45DtU9 gVHiy8fbUB32Es2tzWA/MAtoSqzfpQ8RVpTY+XsuI8RmPol3X3tYQUokBHglOtqEIEpUJOZ0 nWOD2fXxxmNWCNtD4s7vKeyQEI6V+Pi+l20Co/wsJP/MQvLPLITFCxiZVzGKpRYU56anFhsW GMLjNTk/dxMjOPFqme5gnPj2g94hRiYOxkOMEhzMSiK8J3eUpwrxpiRWVqUW5ccXleakFh9i NAWG8ERmKdHkfGDqzyuJNzSxNDAxMzKxMLY0NlMS5z1zpSxVSCA9sSQ1OzW1ILUIpo+Jg1Oq genEjS7nw9VHT1rcXReypvIq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veiJM/3o8/XuVb3vH x44NdW/XOcy2C1T7lX390O5FTEnJ6m32DJwn/Xsc0mqfzFtqwxBaIvT+f67Kqu7FhXOufred 9iPz/VkL7/9eHmdyrqwz+bnqtIyZjvvdG3t8Nde4uVfOTvh//15zB49IeF7mI41j7D7Hvk5Y /ro4VVT7/U/m2qLADUtmnD0kaeYz88KCE0nnXCskHy1dwuIn3LvPOue/wcbpWZ2397zyLAwx j0sqOmu2MWVb2h+x1a/2n2Pcr8RSnJFoqMVcVJwIAD9GZU/yAgAA X-CMS-MailID: 20231213022525epcas1p219483a7572a12394c5852cd53a367da4 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231213022525epcas1p219483a7572a12394c5852cd53a367da4 References: <CGME20231213022525epcas1p219483a7572a12394c5852cd53a367da4@epcas1p2.samsung.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 18:26:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785131823485897806 X-GMAIL-MSGID: 1785131823485897806 |
Series |
scsi: ufs: qcom: Re-fix for error handling
|
|
Commit Message
Chanwoo Lee
Dec. 13, 2023, 2:25 a.m. UTC
From: ChanWoo Lee <cw9316.lee@samsung.com> I modified the code to handle errors. The error handling code has been changed from the patch below. -'commit 031312dbc695 ("scsi: ufs: ufs-qcom: Remove unnecessary goto statements")' What I have confirmed are three cases. 1) ufs_qcom_host_reset -> 'reset_control_deassert' error -> return 0; 2) ufs_qcom_clk_scale_notify -> 'ufs_qcom_clk_scale_up_/down_pre_change' error -> return 0; 3) ufs_qcom_init_lane_clks -> 'ufs_qcom_host_clk_get(tx_lane1_sync_clk)' error -> return 0; It is unknown whether the above commit was intended to change error handling. However, if it is not an intended fix, a patch may be needed. Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com> --- drivers/ufs/host/ufs-qcom.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
Comments
On Wed, Dec 13, 2023 at 11:25:00AM +0900, Chanwoo Lee wrote: > From: ChanWoo Lee <cw9316.lee@samsung.com> > > I modified the code to handle errors. > > The error handling code has been changed from the patch below. > -'commit 031312dbc695 ("scsi: ufs: ufs-qcom: Remove unnecessary goto statements")' > > What I have confirmed are three cases. > 1) ufs_qcom_host_reset -> 'reset_control_deassert' error -> return 0; > 2) ufs_qcom_clk_scale_notify -> 'ufs_qcom_clk_scale_up_/down_pre_change' error -> return 0; > 3) ufs_qcom_init_lane_clks -> 'ufs_qcom_host_clk_get(tx_lane1_sync_clk)' error -> return 0; > > It is unknown whether the above commit was intended to change error handling. > However, if it is not an intended fix, a patch may be needed. I think you're right, these were not intentionally changed. There's a patch series in flight right now that cleans up some of this driver and inadvertently tackles some of the problems below. > > Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com> > --- > drivers/ufs/host/ufs-qcom.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index 96cb8b5b4e66..8a93d93ab08f 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -313,6 +313,8 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host) > > err = ufs_qcom_host_clk_get(dev, "tx_lane1_sync_clk", > &host->tx_l1_sync_clk, true); > + if (err) > + return err; This patch cleans this up: https://lore.kernel.org/linux-arm-msm/20231208065902.11006-2-manivannan.sadhasivam@linaro.org/ > } > > return 0; > @@ -404,9 +406,11 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) > usleep_range(200, 210); > > ret = reset_control_deassert(host->core_reset); > - if (ret) > + if (ret) { > dev_err(hba->dev, "%s: core_reset deassert failed, err = %d\n", > __func__, ret); > + return ret; > + } This patch cleans this up: https://lore.kernel.org/linux-arm-msm/20231208065902.11006-8-manivannan.sadhasivam@linaro.org/#t > > usleep_range(1000, 1100); > > @@ -415,7 +419,7 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) > hba->is_irq_enabled = true; > } > > - return 0; > + return ret; If I'm reading right returning ret is pointless here with your change above (it already returns ret, and it is no longer updated right so the only possible value here is 0? > } > > static u32 ufs_qcom_get_hs_gear(struct ufs_hba *hba) > @@ -1535,7 +1539,7 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, > ufshcd_uic_hibern8_exit(hba); > } > > - return 0; > + return err; > } I think you could move this one up into the PRE_CHANGE block and leave return 0 here? I believe this is the only case not yet covered by the patch series I linked. Good catch! > > static void ufs_qcom_enable_test_bus(struct ufs_qcom_host *host) > -- > 2.29.0 > >
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 96cb8b5b4e66..8a93d93ab08f 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -313,6 +313,8 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host) err = ufs_qcom_host_clk_get(dev, "tx_lane1_sync_clk", &host->tx_l1_sync_clk, true); + if (err) + return err; } return 0; @@ -404,9 +406,11 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) usleep_range(200, 210); ret = reset_control_deassert(host->core_reset); - if (ret) + if (ret) { dev_err(hba->dev, "%s: core_reset deassert failed, err = %d\n", __func__, ret); + return ret; + } usleep_range(1000, 1100); @@ -415,7 +419,7 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) hba->is_irq_enabled = true; } - return 0; + return ret; } static u32 ufs_qcom_get_hs_gear(struct ufs_hba *hba) @@ -1535,7 +1539,7 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, ufshcd_uic_hibern8_exit(hba); } - return 0; + return err; } static void ufs_qcom_enable_test_bus(struct ufs_qcom_host *host)