linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question regarding irq_domain_add_linear fixup in error case
@ 2018-06-13  7:12 Nicholas Mc Guire
  0 siblings, 0 replies; only message in thread
From: Nicholas Mc Guire @ 2018-06-13  7:12 UTC (permalink / raw)
  To: linux-pci


Hi !

 I have a question regarding the MSI setup error path - if the
 irq_domain_add_linear() there were to fail then the prevous call
 irq_domain_add_linear() would leave the irq allocated and
 registered in the reverse mapping (HW -> Host) so should that
 error path no call irq_domain_clear_mapping() ?

 code is from linux-next 4.17.0 (localversion-next 20180613)

/**
 * xilinx_pcie_init_irq_domain - Initialize IRQ domain
 * @port: PCIe port information
 *
 * Return: '0' on success and error value on failure
 */
static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
{
	struct device *dev = port->dev;
	struct device_node *node = dev->of_node;
	struct device_node *pcie_intc_node;

	/* Setup INTx */
	pcie_intc_node = of_get_next_child(node, NULL);
	if (!pcie_intc_node) {
		dev_err(dev, "No PCIe Intc node found\n");
		return -ENODEV;
	}

	port->leg_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
						 &intx_domain_ops,
						 port);
	if (!port->leg_domain) {
		dev_err(dev, "Failed to get a INTx IRQ domain\n");
		return -ENODEV;
	}

	/* Setup MSI */
	if (IS_ENABLED(CONFIG_PCI_MSI)) {
		port->msi_domain = irq_domain_add_linear(node,
							 XILINX_NUM_MSI_IRQS,
							 &msi_domain_ops,
							 &xilinx_pcie_msi_chip);
		if (!port->msi_domain) {
			dev_err(dev, "Failed to get a MSI IRQ domain\n");
+ ??			irq_domain_clear_mapping(port->leg_domain ?? ?? )
			return -ENODEV;
		}

		xilinx_pcie_enable_msi(port);
	}

	return 0;
}

Am I missing something here - or is the cleanup in the MSI setup error case
incomlete ?

thx!
hofrat

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-13  7:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-13  7:12 question regarding irq_domain_add_linear fixup in error case Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).