aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Klein <tklein@de.ibm.com>2009-01-21 17:45:33 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-21 17:45:33 -0500
commit3faf2693bd6800c2521799f6a9ae174d9f080ed2 (patch)
tree264e6516d575c2d385fc47e14f2b3eda54b1de45
parent086c1b2c52f03d128d1a6db47f8736c56e915043 (diff)
ehea: Fix mem allocations which require page alignment
PAGE_SIZE allocations via slab are not guaranteed to be page-aligned. Fixed all memory allocations where page alignment is required by firmware. Signed-off-by: Thomas Klein <tklein@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ehea/ehea_main.c56
-rw-r--r--drivers/net/ehea/ehea_qmr.c4
2 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index d0c2c4569f25..dfcdd7f21c78 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -308,7 +308,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
308 308
309 memset(stats, 0, sizeof(*stats)); 309 memset(stats, 0, sizeof(*stats));
310 310
311 cb2 = kzalloc(PAGE_SIZE, GFP_ATOMIC); 311 cb2 = (void *)get_zeroed_page(GFP_ATOMIC);
312 if (!cb2) { 312 if (!cb2) {
313 ehea_error("no mem for cb2"); 313 ehea_error("no mem for cb2");
314 goto out; 314 goto out;
@@ -341,7 +341,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
341 stats->rx_packets = rx_packets; 341 stats->rx_packets = rx_packets;
342 342
343out_herr: 343out_herr:
344 kfree(cb2); 344 free_page((unsigned long)cb2);
345out: 345out:
346 return stats; 346 return stats;
347} 347}
@@ -915,7 +915,7 @@ int ehea_sense_port_attr(struct ehea_port *port)
915 struct hcp_ehea_port_cb0 *cb0; 915 struct hcp_ehea_port_cb0 *cb0;
916 916
917 /* may be called via ehea_neq_tasklet() */ 917 /* may be called via ehea_neq_tasklet() */
918 cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC); 918 cb0 = (void *)get_zeroed_page(GFP_ATOMIC);
919 if (!cb0) { 919 if (!cb0) {
920 ehea_error("no mem for cb0"); 920 ehea_error("no mem for cb0");
921 ret = -ENOMEM; 921 ret = -ENOMEM;
@@ -996,7 +996,7 @@ int ehea_sense_port_attr(struct ehea_port *port)
996out_free: 996out_free:
997 if (ret || netif_msg_probe(port)) 997 if (ret || netif_msg_probe(port))
998 ehea_dump(cb0, sizeof(*cb0), "ehea_sense_port_attr"); 998 ehea_dump(cb0, sizeof(*cb0), "ehea_sense_port_attr");
999 kfree(cb0); 999 free_page((unsigned long)cb0);
1000out: 1000out:
1001 return ret; 1001 return ret;
1002} 1002}
@@ -1007,7 +1007,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed)
1007 u64 hret; 1007 u64 hret;
1008 int ret = 0; 1008 int ret = 0;
1009 1009
1010 cb4 = kzalloc(PAGE_SIZE, GFP_KERNEL); 1010 cb4 = (void *)get_zeroed_page(GFP_KERNEL);
1011 if (!cb4) { 1011 if (!cb4) {
1012 ehea_error("no mem for cb4"); 1012 ehea_error("no mem for cb4");
1013 ret = -ENOMEM; 1013 ret = -ENOMEM;
@@ -1075,7 +1075,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed)
1075 if (!prop_carrier_state || (port->phy_link == EHEA_PHY_LINK_UP)) 1075 if (!prop_carrier_state || (port->phy_link == EHEA_PHY_LINK_UP))
1076 netif_carrier_on(port->netdev); 1076 netif_carrier_on(port->netdev);
1077 1077
1078 kfree(cb4); 1078 free_page((unsigned long)cb4);
1079out: 1079out:
1080 return ret; 1080 return ret;
1081} 1081}
@@ -1302,7 +1302,7 @@ static int ehea_configure_port(struct ehea_port *port)
1302 struct hcp_ehea_port_cb0 *cb0; 1302 struct hcp_ehea_port_cb0 *cb0;
1303 1303
1304 ret = -ENOMEM; 1304 ret = -ENOMEM;
1305 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); 1305 cb0 = (void *)get_zeroed_page(GFP_KERNEL);
1306 if (!cb0) 1306 if (!cb0)
1307 goto out; 1307 goto out;
1308 1308
@@ -1338,7 +1338,7 @@ static int ehea_configure_port(struct ehea_port *port)
1338 ret = 0; 1338 ret = 0;
1339 1339
1340out_free: 1340out_free:
1341 kfree(cb0); 1341 free_page((unsigned long)cb0);
1342out: 1342out:
1343 return ret; 1343 return ret;
1344} 1344}
@@ -1748,7 +1748,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
1748 goto out; 1748 goto out;
1749 } 1749 }
1750 1750
1751 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); 1751 cb0 = (void *)get_zeroed_page(GFP_KERNEL);
1752 if (!cb0) { 1752 if (!cb0) {
1753 ehea_error("no mem for cb0"); 1753 ehea_error("no mem for cb0");
1754 ret = -ENOMEM; 1754 ret = -ENOMEM;
@@ -1793,7 +1793,7 @@ out_upregs:
1793 ehea_update_bcmc_registrations(); 1793 ehea_update_bcmc_registrations();
1794 spin_unlock(&ehea_bcmc_regs.lock); 1794 spin_unlock(&ehea_bcmc_regs.lock);
1795out_free: 1795out_free:
1796 kfree(cb0); 1796 free_page((unsigned long)cb0);
1797out: 1797out:
1798 return ret; 1798 return ret;
1799} 1799}
@@ -1817,7 +1817,7 @@ static void ehea_promiscuous(struct net_device *dev, int enable)
1817 if ((enable && port->promisc) || (!enable && !port->promisc)) 1817 if ((enable && port->promisc) || (!enable && !port->promisc))
1818 return; 1818 return;
1819 1819
1820 cb7 = kzalloc(PAGE_SIZE, GFP_ATOMIC); 1820 cb7 = (void *)get_zeroed_page(GFP_ATOMIC);
1821 if (!cb7) { 1821 if (!cb7) {
1822 ehea_error("no mem for cb7"); 1822 ehea_error("no mem for cb7");
1823 goto out; 1823 goto out;
@@ -1836,7 +1836,7 @@ static void ehea_promiscuous(struct net_device *dev, int enable)
1836 1836
1837 port->promisc = enable; 1837 port->promisc = enable;
1838out: 1838out:
1839 kfree(cb7); 1839 free_page((unsigned long)cb7);
1840 return; 1840 return;
1841} 1841}
1842 1842
@@ -2217,7 +2217,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
2217 2217
2218 port->vgrp = grp; 2218 port->vgrp = grp;
2219 2219
2220 cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2220 cb1 = (void *)get_zeroed_page(GFP_KERNEL);
2221 if (!cb1) { 2221 if (!cb1) {
2222 ehea_error("no mem for cb1"); 2222 ehea_error("no mem for cb1");
2223 goto out; 2223 goto out;
@@ -2228,7 +2228,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
2228 if (hret != H_SUCCESS) 2228 if (hret != H_SUCCESS)
2229 ehea_error("modify_ehea_port failed"); 2229 ehea_error("modify_ehea_port failed");
2230 2230
2231 kfree(cb1); 2231 free_page((unsigned long)cb1);
2232out: 2232out:
2233 return; 2233 return;
2234} 2234}
@@ -2241,7 +2241,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
2241 int index; 2241 int index;
2242 u64 hret; 2242 u64 hret;
2243 2243
2244 cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2244 cb1 = (void *)get_zeroed_page(GFP_KERNEL);
2245 if (!cb1) { 2245 if (!cb1) {
2246 ehea_error("no mem for cb1"); 2246 ehea_error("no mem for cb1");
2247 goto out; 2247 goto out;
@@ -2262,7 +2262,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
2262 if (hret != H_SUCCESS) 2262 if (hret != H_SUCCESS)
2263 ehea_error("modify_ehea_port failed"); 2263 ehea_error("modify_ehea_port failed");
2264out: 2264out:
2265 kfree(cb1); 2265 free_page((unsigned long)cb1);
2266 return; 2266 return;
2267} 2267}
2268 2268
@@ -2276,7 +2276,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2276 2276
2277 vlan_group_set_device(port->vgrp, vid, NULL); 2277 vlan_group_set_device(port->vgrp, vid, NULL);
2278 2278
2279 cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2279 cb1 = (void *)get_zeroed_page(GFP_KERNEL);
2280 if (!cb1) { 2280 if (!cb1) {
2281 ehea_error("no mem for cb1"); 2281 ehea_error("no mem for cb1");
2282 goto out; 2282 goto out;
@@ -2297,7 +2297,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2297 if (hret != H_SUCCESS) 2297 if (hret != H_SUCCESS)
2298 ehea_error("modify_ehea_port failed"); 2298 ehea_error("modify_ehea_port failed");
2299out: 2299out:
2300 kfree(cb1); 2300 free_page((unsigned long)cb1);
2301 return; 2301 return;
2302} 2302}
2303 2303
@@ -2309,7 +2309,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2309 u64 dummy64 = 0; 2309 u64 dummy64 = 0;
2310 struct hcp_modify_qp_cb0 *cb0; 2310 struct hcp_modify_qp_cb0 *cb0;
2311 2311
2312 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2312 cb0 = (void *)get_zeroed_page(GFP_KERNEL);
2313 if (!cb0) { 2313 if (!cb0) {
2314 ret = -ENOMEM; 2314 ret = -ENOMEM;
2315 goto out; 2315 goto out;
@@ -2372,7 +2372,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2372 2372
2373 ret = 0; 2373 ret = 0;
2374out: 2374out:
2375 kfree(cb0); 2375 free_page((unsigned long)cb0);
2376 return ret; 2376 return ret;
2377} 2377}
2378 2378
@@ -2664,7 +2664,7 @@ int ehea_stop_qps(struct net_device *dev)
2664 u64 dummy64 = 0; 2664 u64 dummy64 = 0;
2665 u16 dummy16 = 0; 2665 u16 dummy16 = 0;
2666 2666
2667 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2667 cb0 = (void *)get_zeroed_page(GFP_KERNEL);
2668 if (!cb0) { 2668 if (!cb0) {
2669 ret = -ENOMEM; 2669 ret = -ENOMEM;
2670 goto out; 2670 goto out;
@@ -2716,7 +2716,7 @@ int ehea_stop_qps(struct net_device *dev)
2716 2716
2717 ret = 0; 2717 ret = 0;
2718out: 2718out:
2719 kfree(cb0); 2719 free_page((unsigned long)cb0);
2720 2720
2721 return ret; 2721 return ret;
2722} 2722}
@@ -2766,7 +2766,7 @@ int ehea_restart_qps(struct net_device *dev)
2766 u64 dummy64 = 0; 2766 u64 dummy64 = 0;
2767 u16 dummy16 = 0; 2767 u16 dummy16 = 0;
2768 2768
2769 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2769 cb0 = (void *)get_zeroed_page(GFP_KERNEL);
2770 if (!cb0) { 2770 if (!cb0) {
2771 ret = -ENOMEM; 2771 ret = -ENOMEM;
2772 goto out; 2772 goto out;
@@ -2819,7 +2819,7 @@ int ehea_restart_qps(struct net_device *dev)
2819 ehea_refill_rq3(pr, 0); 2819 ehea_refill_rq3(pr, 0);
2820 } 2820 }
2821out: 2821out:
2822 kfree(cb0); 2822 free_page((unsigned long)cb0);
2823 2823
2824 return ret; 2824 return ret;
2825} 2825}
@@ -2950,7 +2950,7 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
2950 u64 hret; 2950 u64 hret;
2951 int ret; 2951 int ret;
2952 2952
2953 cb = kzalloc(PAGE_SIZE, GFP_KERNEL); 2953 cb = (void *)get_zeroed_page(GFP_KERNEL);
2954 if (!cb) { 2954 if (!cb) {
2955 ret = -ENOMEM; 2955 ret = -ENOMEM;
2956 goto out; 2956 goto out;
@@ -2967,7 +2967,7 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
2967 ret = 0; 2967 ret = 0;
2968 2968
2969out_herr: 2969out_herr:
2970 kfree(cb); 2970 free_page((unsigned long)cb);
2971out: 2971out:
2972 return ret; 2972 return ret;
2973} 2973}
@@ -2981,7 +2981,7 @@ int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo)
2981 *jumbo = 0; 2981 *jumbo = 0;
2982 2982
2983 /* (Try to) enable *jumbo frames */ 2983 /* (Try to) enable *jumbo frames */
2984 cb4 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2984 cb4 = (void *)get_zeroed_page(GFP_KERNEL);
2985 if (!cb4) { 2985 if (!cb4) {
2986 ehea_error("no mem for cb4"); 2986 ehea_error("no mem for cb4");
2987 ret = -ENOMEM; 2987 ret = -ENOMEM;
@@ -3009,7 +3009,7 @@ int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo)
3009 } else 3009 } else
3010 ret = -EINVAL; 3010 ret = -EINVAL;
3011 3011
3012 kfree(cb4); 3012 free_page((unsigned long)cb4);
3013 } 3013 }
3014out: 3014out:
3015 return ret; 3015 return ret;
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 49d766ebbcf4..3747457f5e69 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -1005,7 +1005,7 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
1005 unsigned long ret; 1005 unsigned long ret;
1006 u64 *rblock; 1006 u64 *rblock;
1007 1007
1008 rblock = kzalloc(PAGE_SIZE, GFP_KERNEL); 1008 rblock = (void *)get_zeroed_page(GFP_KERNEL);
1009 if (!rblock) { 1009 if (!rblock) {
1010 ehea_error("Cannot allocate rblock memory."); 1010 ehea_error("Cannot allocate rblock memory.");
1011 return; 1011 return;
@@ -1022,5 +1022,5 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
1022 else 1022 else
1023 ehea_error("Error data could not be fetched: %llX", res_handle); 1023 ehea_error("Error data could not be fetched: %llX", res_handle);
1024 1024
1025 kfree(rblock); 1025 free_page((unsigned long)rblock);
1026} 1026}