Merge branch 'remotes/lorenzo/pci/misc'
- Exit pcitest with error code when test fails (Jean-Jacques Hiblot) - Fix leaked of_node references in dra7xx, uniphier, layerscape, rockchip, aardvark, iproc, mediatek, rpadlpar (Wen Yang) - Fix pcitest "help" option parsing (Kishon Vijay Abraham I) - Fix Makefile bug that inadvertently removes pcitest.sh (Kishon Vijay Abraham I) - Check for alloc_workqueue() failure in endpoint test driver (Kangjie Lu) * remotes/lorenzo/pci/misc: PCI: endpoint: Fix a potential NULL pointer dereference tools: PCI: Handle pcitest.sh independently from pcitest tools: PCI: Add 'h' in optstring of getopt() PCI: mediatek: Fix a leaked reference by adding missing of_node_put() PCI: iproc: Fix a leaked reference by adding missing of_node_put() PCI: aardvark: Fix a leaked reference by adding missing of_node_put() PCI: rockchip: Fix a leaked reference by adding missing of_node_put() PCI: dwc: layerscape: Fix a leaked reference by adding missing of_node_put() PCI: uniphier: Fix a leaked reference by adding missing of_node_put() PCI: dwc: pci-dra7xx: Fix a leaked reference by adding missing of_node_put() tools: PCI: Exit with error code when test fails
This commit is contained in:
Коммит
ee6df38da8
|
@ -247,6 +247,7 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp)
|
|||
|
||||
dra7xx->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
|
||||
&intx_domain_ops, pp);
|
||||
of_node_put(pcie_intc_node);
|
||||
if (!dra7xx->irq_domain) {
|
||||
dev_err(dev, "Failed to get a INTx IRQ domain\n");
|
||||
return -ENODEV;
|
||||
|
|
|
@ -201,6 +201,7 @@ static int ls_pcie_msi_host_init(struct pcie_port *pp)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
of_node_put(msi_node);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -270,6 +270,7 @@ static int uniphier_pcie_config_legacy_irq(struct pcie_port *pp)
|
|||
struct uniphier_pcie_priv *priv = to_uniphier_pcie(pci);
|
||||
struct device_node *np = pci->dev->of_node;
|
||||
struct device_node *np_intc;
|
||||
int ret = 0;
|
||||
|
||||
np_intc = of_get_child_by_name(np, "legacy-interrupt-controller");
|
||||
if (!np_intc) {
|
||||
|
@ -280,20 +281,24 @@ static int uniphier_pcie_config_legacy_irq(struct pcie_port *pp)
|
|||
pp->irq = irq_of_parse_and_map(np_intc, 0);
|
||||
if (!pp->irq) {
|
||||
dev_err(pci->dev, "Failed to get an IRQ entry in legacy-interrupt-controller\n");
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto out_put_node;
|
||||
}
|
||||
|
||||
priv->legacy_irq_domain = irq_domain_add_linear(np_intc, PCI_NUM_INTX,
|
||||
&uniphier_intx_domain_ops, pp);
|
||||
if (!priv->legacy_irq_domain) {
|
||||
dev_err(pci->dev, "Failed to get INTx domain\n");
|
||||
return -ENODEV;
|
||||
ret = -ENODEV;
|
||||
goto out_put_node;
|
||||
}
|
||||
|
||||
irq_set_chained_handler_and_data(pp->irq, uniphier_pcie_irq_handler,
|
||||
pp);
|
||||
|
||||
return 0;
|
||||
out_put_node:
|
||||
of_node_put(np_intc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int uniphier_pcie_host_init(struct pcie_port *pp)
|
||||
|
|
|
@ -794,6 +794,7 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie)
|
|||
struct device_node *node = dev->of_node;
|
||||
struct device_node *pcie_intc_node;
|
||||
struct irq_chip *irq_chip;
|
||||
int ret = 0;
|
||||
|
||||
pcie_intc_node = of_get_next_child(node, NULL);
|
||||
if (!pcie_intc_node) {
|
||||
|
@ -806,8 +807,8 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie)
|
|||
irq_chip->name = devm_kasprintf(dev, GFP_KERNEL, "%s-irq",
|
||||
dev_name(dev));
|
||||
if (!irq_chip->name) {
|
||||
of_node_put(pcie_intc_node);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto out_put_node;
|
||||
}
|
||||
|
||||
irq_chip->irq_mask = advk_pcie_irq_mask;
|
||||
|
@ -819,11 +820,13 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie)
|
|||
&advk_pcie_irq_domain_ops, pcie);
|
||||
if (!pcie->irq_domain) {
|
||||
dev_err(dev, "Failed to get a INTx IRQ domain\n");
|
||||
of_node_put(pcie_intc_node);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto out_put_node;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out_put_node:
|
||||
of_node_put(pcie_intc_node);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)
|
||||
|
|
|
@ -1356,14 +1356,18 @@ static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
|
|||
if (pcie->need_msi_steer) {
|
||||
ret = iproc_pcie_msi_steer(pcie, msi_node);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out_put_node;
|
||||
}
|
||||
|
||||
/*
|
||||
* If another MSI controller is being used, the call below should fail
|
||||
* but that is okay
|
||||
*/
|
||||
return iproc_msi_init(pcie, msi_node);
|
||||
ret = iproc_msi_init(pcie, msi_node);
|
||||
|
||||
out_put_node:
|
||||
of_node_put(msi_node);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void iproc_pcie_msi_disable(struct iproc_pcie *pcie)
|
||||
|
|
|
@ -578,6 +578,7 @@ static int mtk_pcie_init_irq_domain(struct mtk_pcie_port *port,
|
|||
|
||||
port->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
|
||||
&intx_domain_ops, port);
|
||||
of_node_put(pcie_intc_node);
|
||||
if (!port->irq_domain) {
|
||||
dev_err(dev, "failed to get INTx IRQ domain\n");
|
||||
return -ENODEV;
|
||||
|
|
|
@ -724,6 +724,7 @@ static int rockchip_pcie_init_irq_domain(struct rockchip_pcie *rockchip)
|
|||
|
||||
rockchip->irq_domain = irq_domain_add_linear(intc, PCI_NUM_INTX,
|
||||
&intx_domain_ops, rockchip);
|
||||
of_node_put(intc);
|
||||
if (!rockchip->irq_domain) {
|
||||
dev_err(dev, "failed to get a INTx IRQ domain\n");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -592,6 +592,11 @@ static int __init pci_epf_test_init(void)
|
|||
|
||||
kpcitest_workqueue = alloc_workqueue("kpcitest",
|
||||
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
|
||||
if (!kpcitest_workqueue) {
|
||||
pr_err("Failed to allocate the kpcitest work queue\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = pci_epf_register_driver(&test_driver);
|
||||
if (ret) {
|
||||
pr_err("Failed to register pci epf test driver --> %d\n", ret);
|
||||
|
|
|
@ -14,9 +14,12 @@ MAKEFLAGS += -r
|
|||
|
||||
CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
|
||||
|
||||
ALL_TARGETS := pcitest pcitest.sh
|
||||
ALL_TARGETS := pcitest
|
||||
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
|
||||
|
||||
SCRIPTS := pcitest.sh
|
||||
ALL_SCRIPTS := $(patsubst %,$(OUTPUT)%,$(SCRIPTS))
|
||||
|
||||
all: $(ALL_PROGRAMS)
|
||||
|
||||
export srctree OUTPUT CC LD CFLAGS
|
||||
|
@ -46,6 +49,9 @@ install: $(ALL_PROGRAMS)
|
|||
install -d -m 755 $(DESTDIR)$(bindir); \
|
||||
for program in $(ALL_PROGRAMS); do \
|
||||
install $$program $(DESTDIR)$(bindir); \
|
||||
done; \
|
||||
for script in $(ALL_SCRIPTS); do \
|
||||
install $$script $(DESTDIR)$(bindir); \
|
||||
done
|
||||
|
||||
FORCE:
|
||||
|
|
|
@ -140,6 +140,7 @@ static void run_test(struct pci_test *test)
|
|||
}
|
||||
|
||||
fflush(stdout);
|
||||
return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
@ -162,7 +163,7 @@ int main(int argc, char **argv)
|
|||
/* set default endpoint device */
|
||||
test->device = "/dev/pci-endpoint-test.0";
|
||||
|
||||
while ((c = getopt(argc, argv, "D:b:m:x:i:Ilrwcs:")) != EOF)
|
||||
while ((c = getopt(argc, argv, "D:b:m:x:i:Ilhrwcs:")) != EOF)
|
||||
switch (c) {
|
||||
case 'D':
|
||||
test->device = optarg;
|
||||
|
@ -206,7 +207,6 @@ int main(int argc, char **argv)
|
|||
case 's':
|
||||
test->size = strtoul(optarg, NULL, 0);
|
||||
continue;
|
||||
case '?':
|
||||
case 'h':
|
||||
default:
|
||||
usage:
|
||||
|
@ -224,10 +224,10 @@ usage:
|
|||
"\t-w Write buffer test\n"
|
||||
"\t-c Copy buffer test\n"
|
||||
"\t-s <size> Size of buffer {default: 100KB}\n",
|
||||
"\t-h Print this help message\n",
|
||||
argv[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
run_test(test);
|
||||
return 0;
|
||||
return run_test(test);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче