lkml.org 
[lkml]   [2013]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
Date
On Tuesday 08 January 2013 11:57:30 Sebastian Andrzej Siewior wrote:
> > +static int usb_stor_huawei_scsi_init(struct us_data *us)
> > +{
> > + int result = 0;
> > + int act_len = 0;
> > + struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> > + char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> > + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
> > +
> > + memset(bcbw, 0, sizeof(struct bulk_cb_wrap));
> > + bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
> > + bcbw->Tag = 0;
> > + bcbw->DataTransferLength = 0;
> > + bcbw->Flags = bcbw->Lun = 0;
> > + bcbw->Length = sizeof(rewind_cmd);
>
> I asked earlier and I ask again: why memset to zero followed by init to zero.
> Could we stick to one thing?

We shouldn't. The compiler will do the right thing. This is for the human
reader. You tell the reader that you want.

a) a clean slate to start with
b) you issue a command with certain parameters specified. That these
parameters are zero is beside the point. The point is telling the reader
which parameters are important here.

Regards
Oliver

PS: What about endianness of bcbw->Length?



\
 
 \ /
  Last update: 2013-01-08 13:41    [W:0.043 / U:0.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site