Reduce warnings/errors in libpayload when using picky compiler options
[coreboot.git] / payloads / libpayload / libpci / libpci.c
index 0b54ba338c5d9a21c7f6fced50bc96f6e8b81d9c..203e770e47216f5c2fe73798f723d2e3cc830ca4 100644 (file)
@@ -96,6 +96,8 @@ void pci_filter_init(struct pci_access* pacc, struct pci_filter* pf)
        pf->device = -1;
 }
 
+static char *invalid_pci_device_string = (char *)"invalid pci device string";
+
 /* parse domain:bus:dev.func (with all components but "dev" optional)
  * into filter.
  * Returns NULL on success, a string pointer to the error message otherwise.
@@ -109,7 +111,7 @@ char *pci_filter_parse_slot(struct pci_filter* filter, const char* id)
        char *funcp = strrchr(id, '.');
        if (funcp) {
                filter->func = strtoul(funcp+1, &endptr, 0);
-               if (endptr[0] != '\0') return "invalid pci device string";
+               if (endptr[0] != '\0') return invalid_pci_device_string;
        }
 
        char *devp = strrchr(id, ':');
@@ -118,7 +120,7 @@ char *pci_filter_parse_slot(struct pci_filter* filter, const char* id)
        } else {
                filter->dev = strtoul(devp+1, &endptr, 0);
        }
-       if (endptr != funcp) return "invalid pci device string";
+       if (endptr != funcp) return invalid_pci_device_string;
        if (!devp) return NULL;
 
        char *busp = strchr(id, ':');
@@ -127,11 +129,11 @@ char *pci_filter_parse_slot(struct pci_filter* filter, const char* id)
        } else {
                filter->bus = strtoul(busp+1, &endptr, 0);
        }
-       if (endptr != funcp) return "invalid pci device string";
+       if (endptr != funcp) return invalid_pci_device_string;
        if (busp == devp) return NULL;
 
        filter->domain = strtoul(id, &endptr, 0);
-       if (endptr != busp) return "invalid pci device string";
+       if (endptr != busp) return invalid_pci_device_string;
 
        return NULL;
 }