aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaeyoon Choi <jaeyoon@FreeBSD.org>2026-08-10 01:33:00 +0000
committerJaeyoon Choi <jaeyoon@FreeBSD.org>2026-08-10 02:28:47 +0000
commit154e335cd635436c69ad98723e25988852bd11db (patch)
treebab2525965cde33c74e9303443bda3eedb499624
parent5f3a2b364ea51ea05daa4399693bda2021e39434 (diff)
ufshci: fail attribute reads on a non-zero config result code
ufshci_uic_send_cmd() only logged the error code and returned success, so a failed DME_GET gave its caller a stale value as if it were valid. The gear and lane settings could then be programmed from that garbage. Return ENXIO for reads instead. Writes keep logging and continuing, because a device may reject an optional attribute and that must not fail bring-up. Sponsored by: Samsung Electronics Reviewed by imp (mentor) Differential Revision: https://reviews.freebsd.org/D58654
-rw-r--r--sys/dev/ufshci/ufshci_uic_cmd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/ufshci/ufshci_uic_cmd.c b/sys/dev/ufshci/ufshci_uic_cmd.c
index c6e6afe3f688..03ea8b2ba9f1 100644
--- a/sys/dev/ufshci/ufshci_uic_cmd.c
+++ b/sys/dev/ufshci/ufshci_uic_cmd.c
@@ -199,6 +199,14 @@ ufshci_uic_send_cmd(struct ufshci_controller *ctrlr,
"Failed to send UIC command (Opcode: 0x%x"
", config result code = 0x%x)\n",
uic_cmd->opcode, config_result_code);
+ /*
+ * Reads fail here: there is no valid result to return.
+ * Writes only log the error, so that a rejected optional
+ * attribute does not fail bring-up.
+ */
+ if (return_value != NULL)
+ return (ENXIO);
+ return (0);
}
if (return_value != NULL)