From: Daejun Park Date: Wed, 20 May 2026 07:00:09 +0000 (+0900) Subject: scsi: ufs: core: Skip link param validation when lanes_per_direction is unset X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06a34d9c1f47b923bb554de25406a5251b047379;p=thirdparty%2Flinux.git scsi: ufs: core: Skip link param validation when lanes_per_direction is unset ufshcd_validate_link_params(), added by commit e72323f3b09f ("scsi: ufs: core: Configure only active lanes during link"), is called unconditionally from ufshcd_link_startup() and fails link startup with -ENOLINK when the connected lane count read from the device differs from hba->lanes_per_direction. lanes_per_direction is only set by ufshcd-pltfrm (default 2, or the "lanes-per-direction" devicetree property); ufshcd-pci controllers (e.g. Intel) leave it 0. As the device always reports >= 1 connected lanes, the check can never match and link startup always fails. Reproduced with QEMU's UFS device. Skip the check when lanes_per_direction is unset: with no expected value to validate against, restore the behaviour from before that commit. Fixes: e72323f3b09f ("scsi: ufs: core: Configure only active lanes during link") Signed-off-by: Daejun Park Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Link: https://patch.msgid.link/20260520070009epcms2p6542f3abb7660839e9d8140b3f2f145c3@epcms2p6 Signed-off-by: Martin K. Petersen --- diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index c1a0a79e386d..1061e20786fa 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -5200,6 +5200,16 @@ static int ufshcd_validate_link_params(struct ufs_hba *hba) { int ret, val; + /* + * lanes_per_direction is only populated by the platform glue (it + * defaults to 2 or is read from the "lanes-per-direction" devicetree + * property). Controllers probed via ufshcd-pci leave it unset (0), in + * which case there is no expected lane count to validate the connected + * lanes against. Skip the check instead of failing link startup. + */ + if (!hba->lanes_per_direction) + return 0; + ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES), &val); if (ret)