struct pci_dev *dev = NULL;
int len, mn, bn, dn, fn, i, j;
- if (!a)
+ if (!name)
a->error("dump: File name not given.");
if (!(f = fopen(name, "r")))
a->error("dump: Cannot open %s: %s", name, strerror(errno));
{
char *z = strchr(buf, '\n');
if (!z)
- a->error("dump: line too long or unterminated");
+ {
+ fclose(f);
+ a->error("dump: line too long or unterminated");
+ }
*z-- = 0;
if (z >= buf && *z == '\r')
*z-- = 0;
sscanf(z, "%x", &j) == 1 && j < 256)
{
if (i >= 4096)
- a->error("dump: At most 4096 bytes of config space are supported");
+ {
+ fclose(f);
+ a->error("dump: At most 4096 bytes of config space are supported");
+ }
if (i >= dd->allocated) /* Need to re-allocate the buffer */
{
dump_alloc_data(dev, 4096);
z++;
}
if (*z)
- a->error("dump: Malformed line");
+ {
+ fclose(f);
+ a->error("dump: Malformed line");
+ }
}
}
+ fclose(f);
}
static void
struct pci_methods pm_dump = {
"dump",
+ "Reading of register dumps (set the `dump.name' parameter)",
dump_config,
dump_detect,
dump_init,
pci_generic_fill_info,
dump_read,
dump_write,
+ NULL, /* read_vpd */
NULL, /* init_dev */
dump_cleanup_dev
};