path: root/pcidev.c
diff options
authorCarl-Daniel Hailfinger <>2010-07-06 09:55:48 +0000
committerCarl-Daniel Hailfinger <>2010-07-06 09:55:48 +0000
commit744132af4b9f629716394f9c22f6add71cc73ef9 (patch)
tree46de6c5dc108fc2868603fdc606e7328a83f1703 /pcidev.c
parentd1be52d545329debd2128c1aa8685b31dfaa0a0e (diff)
Various places in the flashrom source feature custom parameter extraction from programmer_param
This led to wildly differing syntax for programmer parameters, and it also voids pretty much every assumption you could make about programmer_param. The latter is a problem for libflashrom. Use extract_param everywhere, clean up related code and make it more foolproof. Add two instances of exit(1) where we have no option to return an error. Remove six instances of exit(1) where returning an error was possible. WARNING: This changes programmer parameter syntax for a few programmers! Corresponding to flashrom svn r1070. Signed-off-by: Carl-Daniel Hailfinger <> Acked-by: Michael Karcher <>
Diffstat (limited to 'pcidev.c')
1 files changed, 4 insertions, 1 deletions
diff --git a/pcidev.c b/pcidev.c
index 3153f15..4cb629d 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -78,10 +78,11 @@ uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar,
uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar,
- const struct pcidev_status *devs, char *pcidev_bdf)
+ const struct pcidev_status *devs)
struct pci_dev *dev;
struct pci_filter filter;
+ char *pcidev_bdf;
char *msg = NULL;
int found = 0;
uint32_t addr = 0, curaddr = 0;
@@ -93,12 +94,14 @@ uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar,
/* Filter by vendor and also bb:dd.f (if supplied by the user). */
filter.vendor = vendor_id;
+ pcidev_bdf = extract_param(&programmer_param, "pci", ",");
if (pcidev_bdf != NULL) {
if ((msg = pci_filter_parse_slot(&filter, pcidev_bdf))) {
msg_perr("Error: %s\n", msg);
+ free(pcidev_bdf);
for (dev = pacc->devices; dev; dev = dev->next) {
if (pci_filter_match(&filter, dev)) {
OpenPOWER on IntegriCloud