Re: [PATCH] scsi: ufs: Zero utp_upiu_req at the beginning of each command

From: Bart Van Assche
Date: Wed Sep 11 2024 - 21:32:20 EST


On 9/10/24 10:39 PM, Avri Altman wrote:
+static void zero_utp_upiu(struct utp_upiu_req *req)
+{
+ memset(&req->utp_upiu, 0, sizeof(req->utp_upiu));
+}

Introducing a function that only calls memset() seems like overkill to
me. Please call memset() directly.

diff --git a/include/uapi/scsi/scsi_bsg_ufs.h b/include/uapi/scsi/scsi_bsg_ufs.h
index 8c29e498ef98..b0d60d54d6c9 100644
--- a/include/uapi/scsi/scsi_bsg_ufs.h
+++ b/include/uapi/scsi/scsi_bsg_ufs.h
@@ -162,11 +162,13 @@ struct utp_upiu_cmd {
*/
struct utp_upiu_req {
struct utp_upiu_header header;
- union {
- struct utp_upiu_cmd sc;
- struct utp_upiu_query qr;
- struct utp_upiu_query uc;
- };
+ struct_group(utp_upiu,
+ union {
+ struct utp_upiu_cmd sc;
+ struct utp_upiu_query qr;
+ struct utp_upiu_query uc;
+ };
+ );
};

Is the above change perhaps independent of the rest of this patch? I
think that this change can be left out.

Thanks,

Bart.