diff options
| -rw-r--r-- | drivers/pci/host/pci-xgene.c | 4 | ||||
| -rw-r--r-- | drivers/pci/pci-sysfs.c | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index aab55474dd0d..ee082c0366ec 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c | |||
| @@ -127,7 +127,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset) | |||
| 127 | return false; | 127 | return false; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, | 130 | static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, |
| 131 | int offset) | 131 | int offset) |
| 132 | { | 132 | { |
| 133 | struct xgene_pcie_port *port = bus->sysdata; | 133 | struct xgene_pcie_port *port = bus->sysdata; |
| @@ -137,7 +137,7 @@ static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, | |||
| 137 | return NULL; | 137 | return NULL; |
| 138 | 138 | ||
| 139 | xgene_pcie_set_rtdid_reg(bus, devfn); | 139 | xgene_pcie_set_rtdid_reg(bus, devfn); |
| 140 | return xgene_pcie_get_cfg_base(bus); | 140 | return xgene_pcie_get_cfg_base(bus) + offset; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | static struct pci_ops xgene_pcie_ops = { | 143 | static struct pci_ops xgene_pcie_ops = { |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index aa012fb3834b..312f23a8429c 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -521,7 +521,8 @@ static ssize_t driver_override_store(struct device *dev, | |||
| 521 | struct pci_dev *pdev = to_pci_dev(dev); | 521 | struct pci_dev *pdev = to_pci_dev(dev); |
| 522 | char *driver_override, *old = pdev->driver_override, *cp; | 522 | char *driver_override, *old = pdev->driver_override, *cp; |
| 523 | 523 | ||
| 524 | if (count > PATH_MAX) | 524 | /* We need to keep extra room for a newline */ |
| 525 | if (count >= (PAGE_SIZE - 1)) | ||
| 525 | return -EINVAL; | 526 | return -EINVAL; |
| 526 | 527 | ||
| 527 | driver_override = kstrndup(buf, count, GFP_KERNEL); | 528 | driver_override = kstrndup(buf, count, GFP_KERNEL); |
| @@ -549,7 +550,7 @@ static ssize_t driver_override_show(struct device *dev, | |||
| 549 | { | 550 | { |
| 550 | struct pci_dev *pdev = to_pci_dev(dev); | 551 | struct pci_dev *pdev = to_pci_dev(dev); |
| 551 | 552 | ||
| 552 | return sprintf(buf, "%s\n", pdev->driver_override); | 553 | return snprintf(buf, PAGE_SIZE, "%s\n", pdev->driver_override); |
| 553 | } | 554 | } |
| 554 | static DEVICE_ATTR_RW(driver_override); | 555 | static DEVICE_ATTR_RW(driver_override); |
| 555 | 556 | ||
