bridge: Switch to bitmap_zalloc()
Switch to bitmap_zalloc() to show clearly what we are allocating. Besides that it returns pointer of bitmap type instead of opaque void *. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
0340376ecc
commit
459479da97
@@ -394,8 +394,7 @@ static int find_portno(struct net_bridge *br)
|
|||||||
struct net_bridge_port *p;
|
struct net_bridge_port *p;
|
||||||
unsigned long *inuse;
|
unsigned long *inuse;
|
||||||
|
|
||||||
inuse = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long),
|
inuse = bitmap_zalloc(BR_MAX_PORTS, GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!inuse)
|
if (!inuse)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@@ -404,7 +403,7 @@ static int find_portno(struct net_bridge *br)
|
|||||||
set_bit(p->port_no, inuse);
|
set_bit(p->port_no, inuse);
|
||||||
}
|
}
|
||||||
index = find_first_zero_bit(inuse, BR_MAX_PORTS);
|
index = find_first_zero_bit(inuse, BR_MAX_PORTS);
|
||||||
kfree(inuse);
|
bitmap_free(inuse);
|
||||||
|
|
||||||
return (index >= BR_MAX_PORTS) ? -EXFULL : index;
|
return (index >= BR_MAX_PORTS) ? -EXFULL : index;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -877,8 +877,7 @@ int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long),
|
changed = bitmap_zalloc(BR_MAX_PORTS, GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!changed)
|
if (!changed)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@@ -925,7 +924,7 @@ int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)
|
|||||||
br->default_pvid = pvid;
|
br->default_pvid = pvid;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
kfree(changed);
|
bitmap_free(changed);
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err_port:
|
err_port:
|
||||||
|
|||||||
Reference in New Issue
Block a user