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

From: Avri Altman
Date: Thu Sep 12 2024 - 02:52:08 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.
Done.

>
> > 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.
Done.

P.S.
I wanted to make zero_utp_upiu() oblivious of its callers.
I guess I can just do that by just naming that union.

Thanks,
Avri

>
> Thanks,
>
> Bart.