Re: [PATCH 1/1]linux-usb:optimize to match the Huawei USB storage devices and support new switch command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux