[SeaBIOS] [PATCH v4] Add pvscsi boot support
Kevin O'Connor
kevin at koconnor.net
Tue Oct 15 01:34:58 CEST 2013
On Mon, Oct 14, 2013 at 11:11:57PM +0200, Paul Menzel wrote:
> Am Montag, den 14.10.2013, 18:03 +0300 schrieb Evgeny Budilovsky:
> > +static int
> > +pvscsi_add_lun(struct pci_device *pci, u32 iobase,
> > + struct pvscsi_ring_dsc_s *ring_dsc, u8 target, u8 lun)
> > +{
> > + struct pvscsi_lun_s *plun = malloc_fseg(sizeof(*plun));
> > + if (!plun) {
> > + warn_noalloc();
> > + return -1;
> > + }
> > + memset(plun, 0, sizeof(*plun));
>
> I missed that yesterday. This `memset()` seems unneeded too as below all
> members are set explicitly.
>
> > + plun->drive.type = DTYPE_PVSCSI;
> > + plun->drive.cntl_id = pci->bdf;
> > + plun->pci = pci;
> > + plun->target = target;
> > + plun->lun = lun;
> > + plun->iobase = iobase;
> > + plun->ring_dsc = ring_dsc;
>
> […]
>
> Kevin, could you please reply, if another iteration is needed or if you
> can remove that `memset()` yourself, when applying this patch?
It's good practice to call memset - it clears out pad bytes, makes the
code more future proof, and there is no real downside to it.
-Kevin
More information about the SeaBIOS
mailing list