On Thu, Jan 07, 2021 at 10:48:15PM +0100, Heiner Kallweit wrote: > Since 104daa71b396 ("PCI: Determine actual VPD size on first access") > attribute size is set to 0 (unlimited). So let's remove this now > dead code. Doesn't the 104daa71b396 commit log say "attr->size == 0" means the size is unknown (not unlimited)? But I don't think vpd.c does anything at all with attr->size other than set it to zero. Is there some reason we can't remove the "attr->size = 0" assignment, too? Maybe the sysfs attribute code uses it? But I don't see vpd.c doing anything that would contribute to that. Sorry, I'm just puzzled. > Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx> > --- > drivers/pci/vpd.c | 14 -------------- > 1 file changed, 14 deletions(-) > > diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c > index 7915d10f9..a3fd09105 100644 > --- a/drivers/pci/vpd.c > +++ b/drivers/pci/vpd.c > @@ -403,13 +403,6 @@ static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj, > { > struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj)); > > - if (bin_attr->size > 0) { > - if (off > bin_attr->size) > - count = 0; > - else if (count > bin_attr->size - off) > - count = bin_attr->size - off; > - } > - > return pci_read_vpd(dev, off, count, buf); > } > > @@ -419,13 +412,6 @@ static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj, > { > struct pci_dev *dev = to_pci_dev(kobj_to_dev(kobj)); > > - if (bin_attr->size > 0) { > - if (off > bin_attr->size) > - count = 0; > - else if (count > bin_attr->size - off) > - count = bin_attr->size - off; > - } > - > return pci_write_vpd(dev, off, count, buf); > } > > -- > 2.30.0 > >