lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140325070543.GA26998@electric-eye.fr.zoreil.com>
Date:	Tue, 25 Mar 2014 08:05:44 +0100
From:	Francois Romieu <romieu@...zoreil.com>
To:	Byungho An <bh74.an@...sung.com>
Cc:	netdev@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
	devicetree@...r.kernel.org, "'David Miller'" <davem@...emloft.net>,
	"'GIRISH K S'" <ks.giri@...sung.com>,
	"'SIVAREDDY KALLAM'" <siva.kallam@...sung.com>,
	"'Vipul Chandrakant'" <vipul.pandya@...sung.com>,
	"'Ilho Lee'" <ilho215.lee@...sung.com>
Subject: Re: [PATCH V13 2/7] net: sxgbe: add basic framework for Samsung 10Gb
 ethernet driver

Byungho An <bh74.an@...sung.com> :
[...]
> 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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ