mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
a0ee7c70b2
commit
0da974f4f3
94 changed files with 154 additions and 334 deletions
|
|
@ -370,12 +370,11 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
|
|||
* used by the ioctl call to read call information
|
||||
* and to execute commands.
|
||||
*/
|
||||
if ((mbox_ptr = kmalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
|
||||
if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
|
||||
wanpipe_kill_sock_irq (newsk);
|
||||
release_device(dev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset(mbox_ptr, 0, sizeof(mbox_cmd_t));
|
||||
memcpy(mbox_ptr,skb->data,skb->len);
|
||||
|
||||
/* Register the lcn on which incoming call came
|
||||
|
|
@ -507,11 +506,10 @@ static struct sock *wanpipe_alloc_socket(void)
|
|||
if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &wanpipe_proto, 1)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((wan_opt = kmalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) {
|
||||
if ((wan_opt = kzalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) {
|
||||
sk_free(sk);
|
||||
return NULL;
|
||||
}
|
||||
memset(wan_opt, 0x00, sizeof(struct wanpipe_opt));
|
||||
|
||||
wp_sk(sk) = wan_opt;
|
||||
|
||||
|
|
@ -2011,10 +2009,9 @@ static int set_ioctl_cmd (struct sock *sk, void *arg)
|
|||
|
||||
dev_put(dev);
|
||||
|
||||
if ((mbox_ptr = kmalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL)
|
||||
if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(mbox_ptr, 0, sizeof(mbox_cmd_t));
|
||||
wp_sk(sk)->mbox = mbox_ptr;
|
||||
|
||||
wanpipe_link_driver(dev,sk);
|
||||
|
|
|
|||
|
|
@ -642,18 +642,16 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
|
|||
|
||||
if (cnf->config_id == WANCONFIG_MPPP) {
|
||||
#ifdef CONFIG_WANPIPE_MULTPPP
|
||||
pppdev = kmalloc(sizeof(struct ppp_device), GFP_KERNEL);
|
||||
pppdev = kzalloc(sizeof(struct ppp_device), GFP_KERNEL);
|
||||
err = -ENOBUFS;
|
||||
if (pppdev == NULL)
|
||||
goto out;
|
||||
memset(pppdev, 0, sizeof(struct ppp_device));
|
||||
pppdev->dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
|
||||
pppdev->dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
|
||||
if (pppdev->dev == NULL) {
|
||||
kfree(pppdev);
|
||||
err = -ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
memset(pppdev->dev, 0, sizeof(struct net_device));
|
||||
err = wandev->new_if(wandev, (struct net_device *)pppdev, cnf);
|
||||
dev = pppdev->dev;
|
||||
#else
|
||||
|
|
@ -663,11 +661,10 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
|
|||
goto out;
|
||||
#endif
|
||||
} else {
|
||||
dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
|
||||
dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
|
||||
err = -ENOBUFS;
|
||||
if (dev == NULL)
|
||||
goto out;
|
||||
memset(dev, 0, sizeof(struct net_device));
|
||||
err = wandev->new_if(wandev, dev, cnf);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue