mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
Use ARRAY_SIZE macro
This commit is contained in:
parent
cbaffeeac7
commit
ac9dac0365
@ -87,7 +87,7 @@ static irqreturn_t mqnic_interrupt(int irq, void *data)
|
||||
|
||||
int k, l;
|
||||
|
||||
for (k = 0; k < MQNIC_MAX_IF; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(mqnic->ndev); k++)
|
||||
{
|
||||
if (unlikely(!mqnic->ndev[k]))
|
||||
continue;
|
||||
@ -318,7 +318,7 @@ static int mqnic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent
|
||||
// error handling
|
||||
fail_miscdev:
|
||||
fail_init_netdev:
|
||||
for (k = 0; k < MQNIC_MAX_IF; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(mqnic->ndev); k++)
|
||||
{
|
||||
if (mqnic->ndev[k])
|
||||
{
|
||||
@ -361,7 +361,7 @@ static void mqnic_pci_remove(struct pci_dev *pdev)
|
||||
list_del(&mqnic->dev_list_node);
|
||||
spin_unlock(&mqnic_devices_lock);
|
||||
|
||||
for (k = 0; k < MQNIC_MAX_IF; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(mqnic->ndev); k++)
|
||||
{
|
||||
if (mqnic->ndev[k])
|
||||
{
|
||||
|
@ -632,7 +632,7 @@ void mqnic_destroy_netdev(struct net_device *ndev)
|
||||
mdev->ndev[priv->port] = NULL;
|
||||
|
||||
// free rings
|
||||
for (k = 0; k < MQNIC_MAX_EVENT_RINGS; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(priv->event_ring); k++)
|
||||
{
|
||||
if (priv->event_ring[k])
|
||||
{
|
||||
@ -640,7 +640,7 @@ void mqnic_destroy_netdev(struct net_device *ndev)
|
||||
}
|
||||
}
|
||||
|
||||
for (k = 0; k < MQNIC_MAX_TX_RINGS; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(priv->tx_ring); k++)
|
||||
{
|
||||
if (priv->tx_ring[k])
|
||||
{
|
||||
@ -648,7 +648,7 @@ void mqnic_destroy_netdev(struct net_device *ndev)
|
||||
}
|
||||
}
|
||||
|
||||
for (k = 0; k < MQNIC_MAX_TX_CPL_RINGS; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(priv->tx_cpl_ring); k++)
|
||||
{
|
||||
if (priv->tx_cpl_ring[k])
|
||||
{
|
||||
@ -656,7 +656,7 @@ void mqnic_destroy_netdev(struct net_device *ndev)
|
||||
}
|
||||
}
|
||||
|
||||
for (k = 0; k < MQNIC_MAX_RX_RINGS; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(priv->rx_ring); k++)
|
||||
{
|
||||
if (priv->rx_ring[k])
|
||||
{
|
||||
@ -664,7 +664,7 @@ void mqnic_destroy_netdev(struct net_device *ndev)
|
||||
}
|
||||
}
|
||||
|
||||
for (k = 0; k < MQNIC_MAX_RX_CPL_RINGS; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(priv->rx_cpl_ring); k++)
|
||||
{
|
||||
if (priv->rx_cpl_ring[k])
|
||||
{
|
||||
@ -672,7 +672,7 @@ void mqnic_destroy_netdev(struct net_device *ndev)
|
||||
}
|
||||
}
|
||||
|
||||
for (k = 0; k < MQNIC_MAX_PORTS; k++)
|
||||
for (k = 0; k < ARRAY_SIZE(priv->ports); k++)
|
||||
{
|
||||
if (priv->ports[k])
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user