Re: [PATCH V13 2/7] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Byungho An <bh74.an@xxxxxxxxxxx> :
[...]
> How about below ?

The for loops should be unrolled.

(style: no need to join before branching)

I must go to work, so you'll have to fill the dots in the code below:

        priv = sxgbe_drv_probe(&(pdev->dev), plat_dat, addr);
        if (!priv) {
                pr_err("%s: main driver probe failed\n", __func__);
                goto err_something;
        }

        /* Get the SXGBE common INT information */
        priv->irq  = irq_of_parse_and_map(node, 0);
        if (priv->irq <= 0) {
                dev_err(dev, "sxgbe common irq parsing failed\n");
                goto err_drv_remove;
        }

        /* Get the TX/RX IRQ numbers */
        for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) {
                priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++);
                if (priv->txq[i]->irq_no <= 0) {
                        dev_err(dev, "sxgbe tx irq parsing failed\n");
                        goto err_tx_irq_unmap;
                }
        }

        for (i = 0; i < SXGBE_RX_QUEUES; i++) {
                priv->rxq[i]->irq_no = irq_of_parse_and_map(node, chan++);
                if (priv->rxq[i]->irq_no <= 0) {
                        dev_err(dev, "sxgbe rx irq parsing failed\n");
                        goto err_rx_irq_unmap;
                }
        }

        platform_set_drvdata(pdev, priv->dev);

        pr_debug("platform driver registration completed\n");

        return 0;

err_rx_irq_unmap:
	/* TODO: check that 'i' isn't unsigned. */
	while (i--)
		irq_dispose_mapping(priv->rx[i]->irq_no);
	i = SXGBE_TX_QUEUES;
err_tx_irq_unmap:
	while (i--)
		irq_dispose_mapping(priv->tx[i]->irq_no);
	irq_dispose_mapping(priv->irq);
err_drv_remove:
        sxgbe_drv_remove(ndev);
err_something:
	...

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux