Exporting sysfs files that can't be accessed doesn't make much sense.
Therefore, if either a quirk or the dynamic size calculation result in VPD
being marked as invalid, treat this as though the device has no VPD
capability. One consequence is that the "vpd" sysfs file is not visible.
Link: https://lore.kernel.org/r/6a02b204-4ed2-4553-c3b2-eacf9554fa8d@gmail.com
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
if (pos < 0)
return -EINVAL;
- if (vpd->len == PCI_VPD_SZ_INVALID)
- return -EIO;
-
if (pos > vpd->len)
return 0;
if (pos < 0 || (pos & 3) || (count & 3))
return -EINVAL;
- if (vpd->len == PCI_VPD_SZ_INVALID)
- return -EIO;
-
if (end > vpd->len)
return -EINVAL;
if (!dev->vpd.len)
dev->vpd.len = pci_vpd_size(dev);
+
+ if (dev->vpd.len == PCI_VPD_SZ_INVALID)
+ dev->vpd.cap = 0;
}
static ssize_t vpd_read(struct file *filp, struct kobject *kobj,