Re: [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code
From: Bart Van Assche
Date: Tue Jun 17 2025 - 12:13:04 EST
On 6/17/25 2:56 AM, Avri Altman wrote:
UPIU_TRANSACTION_NOP_OUT is 0x0, which is the default value after
memset. Comment out the explicit assignment and leave it as
documentation.
This description is based on the assumption that the compiler only
initializes the data structure members that have been mentioned
explicitly. That is wrong. There is no partial initialization in the
C programming language. Structure members that have not been mentioned
explicitly are zero-initialized. All structure members, including those
that have not been mentioned explicitly, are copied when performing
structure assignment.
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index c2048aca09fc..84165b45467d 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2835,7 +2835,7 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp)
memset(ucd_req_ptr, 0, sizeof(struct utp_upiu_req));
ucd_req_ptr->header = (struct utp_upiu_header){
- .transaction_code = UPIU_TRANSACTION_NOP_OUT,
+ /* .transaction_code = UPIU_TRANSACTION_NOP_OUT = 0x0, */
.task_tag = lrbp->task_tag,
};
}
This patch probably doesn't change the generated assembly code. So I
don't think that it is useful.
Bart.