From: Larisa Grigore <larisa.grigore@oss.nxp.com>
To: Larisa Grigore <larisa.grigore@oss.nxp.com>,
NXP S32 Linux Team <s32@nxp.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@sandisk.com>,
Bart Van Assche <bvanassche@acm.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <mkp@kernel.org>,
Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>,
Ajay Neeli <ajay.neeli@amd.com>,
Manivannan Sadhasivam <mani@kernel.org>,
Pedro Sousa <pedrom.sousa@synopsys.com>
Cc: linux-scsi@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, clizzi@redhat.com,
aruizrui@redhat.com, eballetb@redhat.com, echanude@redhat.com
Subject: [PATCH v4 01/11] scsi: ufs: dwc: Return a negative error if the link is down
Date: Thu, 17 Sep 2026 11:15:45 +0200 [thread overview]
Message-ID: <20260917091555.1443076-2-larisa.grigore@oss.nxp.com> (raw)
In-Reply-To: <20260917091555.1443076-1-larisa.grigore@oss.nxp.com>
ufshcd_dwc_link_is_up() returns 1 when the UniPro link is not up. The
value may propagate through callers that expect failures to be reported as
negative errno values.
Return -ENOLINK when the link is down and propagate errors returned by
ufshcd_dme_get().
Fixes: 4b9ffb5a353b ("ufs: add support for DesignWare Controller")
Signed-off-by: Larisa Grigore <larisa.grigore@oss.nxp.com>
---
drivers/ufs/host/ufshcd-dwc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/ufs/host/ufshcd-dwc.c b/drivers/ufs/host/ufshcd-dwc.c
index 21b1cf912dcc..ccf785fce6cc 100644
--- a/drivers/ufs/host/ufshcd-dwc.c
+++ b/drivers/ufs/host/ufshcd-dwc.c
@@ -48,20 +48,23 @@ static void ufshcd_dwc_program_clk_div(struct ufs_hba *hba, u32 divider_val)
* ufshcd_dwc_link_is_up() - check if link is up.
* @hba: private structure pointer
*
- * Return: 0 on success, non-zero value on failure.
+ * Return: 0 on success, a negative errno value on failure.
*/
static int ufshcd_dwc_link_is_up(struct ufs_hba *hba)
{
int dme_result = 0;
+ int ret;
- ufshcd_dme_get(hba, UIC_ARG_MIB(VS_POWERSTATE), &dme_result);
+ ret = ufshcd_dme_get(hba, UIC_ARG_MIB(VS_POWERSTATE), &dme_result);
+ if (ret)
+ return ret;
if (dme_result == UFSHCD_LINK_IS_UP) {
ufshcd_set_link_active(hba);
return 0;
}
- return 1;
+ return -ENOLINK;
}
/**
--
2.43.0
next prev parent reply other threads:[~2026-09-17 9:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 9:15 [PATCH v4 00/11] Add S32N79RDB UFS support Larisa Grigore
2026-09-17 9:15 ` Larisa Grigore [this message]
2026-09-17 15:58 ` [PATCH v4 01/11] scsi: ufs: dwc: Return a negative error if the link is down Frank Li
2026-09-17 9:15 ` [PATCH v4 02/11] ufs: unipro: Move Tx/Rx FSM state definitions to unipro.h Larisa Grigore
2026-09-17 9:15 ` [PATCH v4 03/11] ufs: unipro: Add TX/RX FSM state attributes Larisa Grigore
2026-09-17 9:15 ` [PATCH v4 04/11] ufs: host: Add common Hibern8 TX FSM polling helper Larisa Grigore
2026-09-17 16:03 ` Frank Li
2026-09-17 9:15 ` [PATCH v4 05/11] scsi: ufs: Move Versal2 M-PHY CREG access helpers into ufshcd-dwc Larisa Grigore
2026-09-17 9:15 ` [PATCH v4 06/11] scsi: ufs: dwc: Export common clock divider and link status helpers Larisa Grigore
2026-09-17 9:15 ` [PATCH v4 07/11] dt-bindings: ufs: Add NXP S32N79 UFS host controller Larisa Grigore
2026-09-18 9:49 ` Krzysztof Kozlowski
2026-09-17 9:15 ` [PATCH v4 08/11] scsi: ufs: Add NXP S32N79 UFS host controller driver Larisa Grigore
2026-09-17 16:18 ` Frank Li
2026-09-17 9:15 ` [PATCH v4 09/11] arm64: dts: freescale: s32n79: Add UFS host controller Larisa Grigore
2026-09-17 9:15 ` [PATCH v4 10/11] arm64: dts: freescale: s32n79-rdb: Enable UFS Larisa Grigore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260917091555.1443076-2-larisa.grigore@oss.nxp.com \
--to=larisa.grigore@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=ajay.neeli@amd.com \
--cc=alim.akhtar@samsung.com \
--cc=aruizrui@redhat.com \
--cc=avri.altman@sandisk.com \
--cc=bvanassche@acm.org \
--cc=clizzi@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=eballetb@redhat.com \
--cc=echanude@redhat.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mkp@kernel.org \
--cc=pedrom.sousa@synopsys.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=sai.krishna.potthuri@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®