diff options
Diffstat (limited to 'drivers/net/rionet.c')
-rw-r--r-- | drivers/net/rionet.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index a57f05726b57..91d25888a1b9 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -375,8 +375,8 @@ static void rionet_remove(struct rio_dev *rdev) | |||
375 | struct net_device *ndev = rio_get_drvdata(rdev); | 375 | struct net_device *ndev = rio_get_drvdata(rdev); |
376 | struct rionet_peer *peer, *tmp; | 376 | struct rionet_peer *peer, *tmp; |
377 | 377 | ||
378 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? | 378 | free_pages((unsigned long)rionet_active, get_order(sizeof(void *) * |
379 | __fls(sizeof(void *)) + 4 : 0); | 379 | RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size))); |
380 | unregister_netdev(ndev); | 380 | unregister_netdev(ndev); |
381 | free_netdev(ndev); | 381 | free_netdev(ndev); |
382 | 382 | ||
@@ -432,15 +432,16 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) | |||
432 | int rc = 0; | 432 | int rc = 0; |
433 | struct rionet_private *rnet; | 433 | struct rionet_private *rnet; |
434 | u16 device_id; | 434 | u16 device_id; |
435 | const size_t rionet_active_bytes = sizeof(void *) * | ||
436 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size); | ||
435 | 437 | ||
436 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, | 438 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, |
437 | mport->sys_size ? __fls(sizeof(void *)) + 4 : 0); | 439 | get_order(rionet_active_bytes)); |
438 | if (!rionet_active) { | 440 | if (!rionet_active) { |
439 | rc = -ENOMEM; | 441 | rc = -ENOMEM; |
440 | goto out; | 442 | goto out; |
441 | } | 443 | } |
442 | memset((void *)rionet_active, 0, sizeof(void *) * | 444 | memset((void *)rionet_active, 0, rionet_active_bytes); |
443 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size)); | ||
444 | 445 | ||
445 | /* Set up private area */ | 446 | /* Set up private area */ |
446 | rnet = netdev_priv(ndev); | 447 | rnet = netdev_priv(ndev); |