Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update
@ 2026-11-16 13:39 Enric Balletbo i Serra
  2026-11-16 13:51 ` sashiko-bot
  2026-11-16 14:38 ` Larisa Ileana Grigore
  0 siblings, 2 replies; 3+ messages in thread
From: Enric Balletbo i Serra @ 2026-11-16 13:39 UTC (permalink / raw)
  To: Alim Akhtar, Bart Van Assche, Bean Huo, Stanley Jhu,
	James E.J. Bottomley, Martin K. Petersen, Mike Bi, Avri Altman,
	Thomas Weißschuh
  Cc: Luca Porzio, linux-scsi, linux-kernel, NXP S32 Linux Team,
	linux-arm-kernel, Frank Li, Larisa Grigore,
	Enric Balletbo i Serra

ufshcd_update_rtc() uses ufshcd_query_attr() directly to write the
bSecondsPassed attribute, making it the only query attribute caller in
the UFS core that does not use the retry variant. All other callers use
ufshcd_query_attr_retry(), which retries up to three times on transient
failures before escalating to dev_err.

This causes spurious error messages during boot on some platforms when
the write-attribute command hits a transient OCS_INVALID_COMMAND_STATUS
error:

  ufs-s32n7 4ac80000.ufs: ufshcd_query_attr: opcode 0x04 for idn 15 failed, index 0, err = 15
  ufs-s32n7 4ac80000.ufs: ufshcd_update_rtc: Failed to update rtc 15

Switch to ufshcd_query_attr_retry() to handle transient failures
gracefully, consistent with every other attribute query in the driver.

Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
---
 drivers/ufs/core/ufshcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 3c28bc67c65f..1cd32b7cc967 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8821,8 +8821,8 @@ static void ufshcd_update_rtc(struct ufs_hba *hba)
 	if (ufshcd_rpm_get_if_active(hba) <= 0)
 		return;
 
-	err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,
-				0, 0, &val);
+	err = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
+				     QUERY_ATTR_IDN_SECONDS_PASSED, 0, 0, &val);
 	ufshcd_rpm_put(hba);
 
 	if (err)

---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261116-ufs-rtc-query-retry-3f27084f878f

Best regards,
-- 
Enric Balletbo i Serra <eballetb@redhat.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-16 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 13:39 [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update Enric Balletbo i Serra
2026-11-16 13:51 ` sashiko-bot
2026-11-16 14:38 ` Larisa Ileana Grigore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox