You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] isdn: replace kmalloc+memset with kzalloc
Acked-by: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
0b2dd130a5
commit
41f96935b4
@@ -573,12 +573,11 @@ act2000_alloccard(int bus, int port, int irq, char *id)
|
||||
{
|
||||
int i;
|
||||
act2000_card *card;
|
||||
if (!(card = (act2000_card *) kmalloc(sizeof(act2000_card), GFP_KERNEL))) {
|
||||
if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
|
||||
printk(KERN_WARNING
|
||||
"act2000: (%s) Could not allocate card-struct.\n", id);
|
||||
return;
|
||||
}
|
||||
memset((char *) card, 0, sizeof(act2000_card));
|
||||
spin_lock_init(&card->lock);
|
||||
spin_lock_init(&card->mnlock);
|
||||
skb_queue_head_init(&card->sndq);
|
||||
|
||||
@@ -215,13 +215,12 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
|
||||
unsigned int minor = 0;
|
||||
unsigned long flags;
|
||||
|
||||
mp = kmalloc(sizeof(*mp), GFP_ATOMIC);
|
||||
mp = kzalloc(sizeof(*mp), GFP_ATOMIC);
|
||||
if (!mp) {
|
||||
printk(KERN_ERR "capi: can't alloc capiminor\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(mp, 0, sizeof(struct capiminor));
|
||||
mp->ap = ap;
|
||||
mp->ncci = ncci;
|
||||
mp->msgid = 0;
|
||||
@@ -304,10 +303,9 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
|
||||
struct capiminor *mp = NULL;
|
||||
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
|
||||
|
||||
np = kmalloc(sizeof(*np), GFP_ATOMIC);
|
||||
np = kzalloc(sizeof(*np), GFP_ATOMIC);
|
||||
if (!np)
|
||||
return NULL;
|
||||
memset(np, 0, sizeof(struct capincci));
|
||||
np->ncci = ncci;
|
||||
np->cdev = cdev;
|
||||
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
|
||||
@@ -384,10 +382,9 @@ static struct capidev *capidev_alloc(void)
|
||||
struct capidev *cdev;
|
||||
unsigned long flags;
|
||||
|
||||
cdev = kmalloc(sizeof(*cdev), GFP_KERNEL);
|
||||
cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
|
||||
if (!cdev)
|
||||
return NULL;
|
||||
memset(cdev, 0, sizeof(struct capidev));
|
||||
|
||||
init_MUTEX(&cdev->ncci_list_sem);
|
||||
skb_queue_head_init(&cdev->recvqueue);
|
||||
|
||||
@@ -334,12 +334,11 @@ static capidrv_plci *new_plci(capidrv_contr * card, int chan)
|
||||
{
|
||||
capidrv_plci *plcip;
|
||||
|
||||
plcip = (capidrv_plci *) kmalloc(sizeof(capidrv_plci), GFP_ATOMIC);
|
||||
plcip = kzalloc(sizeof(capidrv_plci), GFP_ATOMIC);
|
||||
|
||||
if (plcip == 0)
|
||||
return NULL;
|
||||
|
||||
memset(plcip, 0, sizeof(capidrv_plci));
|
||||
plcip->state = ST_PLCI_NONE;
|
||||
plcip->plci = 0;
|
||||
plcip->msgid = 0;
|
||||
@@ -404,12 +403,11 @@ static inline capidrv_ncci *new_ncci(capidrv_contr * card,
|
||||
{
|
||||
capidrv_ncci *nccip;
|
||||
|
||||
nccip = (capidrv_ncci *) kmalloc(sizeof(capidrv_ncci), GFP_ATOMIC);
|
||||
nccip = kzalloc(sizeof(capidrv_ncci), GFP_ATOMIC);
|
||||
|
||||
if (nccip == 0)
|
||||
return NULL;
|
||||
|
||||
memset(nccip, 0, sizeof(capidrv_ncci));
|
||||
nccip->ncci = ncci;
|
||||
nccip->state = ST_NCCI_NONE;
|
||||
nccip->plcip = plcip;
|
||||
@@ -2005,12 +2003,11 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp)
|
||||
printk(KERN_WARNING "capidrv: (%s) Could not reserve module\n", id);
|
||||
return -1;
|
||||
}
|
||||
if (!(card = (capidrv_contr *) kmalloc(sizeof(capidrv_contr), GFP_ATOMIC))) {
|
||||
if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) {
|
||||
printk(KERN_WARNING
|
||||
"capidrv: (%s) Could not allocate contr-struct.\n", id);
|
||||
return -1;
|
||||
}
|
||||
memset(card, 0, sizeof(capidrv_contr));
|
||||
card->owner = THIS_MODULE;
|
||||
init_timer(&card->listentimer);
|
||||
strcpy(card->name, id);
|
||||
|
||||
@@ -121,10 +121,9 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
|
||||
p_dev->conf.Present = PRESENT_OPTION;
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local)
|
||||
goto err;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
p_dev->priv = local;
|
||||
|
||||
return avmcs_config(p_dev);
|
||||
|
||||
@@ -65,18 +65,15 @@ avmcard *b1_alloc_card(int nr_controllers)
|
||||
avmctrl_info *cinfo;
|
||||
int i;
|
||||
|
||||
card = kmalloc(sizeof(*card), GFP_KERNEL);
|
||||
card = kzalloc(sizeof(*card), GFP_KERNEL);
|
||||
if (!card)
|
||||
return NULL;
|
||||
|
||||
memset(card, 0, sizeof(*card));
|
||||
|
||||
cinfo = kmalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL);
|
||||
cinfo = kzalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL);
|
||||
if (!cinfo) {
|
||||
kfree(card);
|
||||
return NULL;
|
||||
}
|
||||
memset(cinfo, 0, sizeof(*cinfo) * nr_controllers);
|
||||
|
||||
card->ctrlinfo = cinfo;
|
||||
for (i = 0; i < nr_controllers; i++) {
|
||||
@@ -718,12 +715,11 @@ avmcard_dma_alloc(char *name, struct pci_dev *pdev, long rsize, long ssize)
|
||||
avmcard_dmainfo *p;
|
||||
void *buf;
|
||||
|
||||
p = kmalloc(sizeof(avmcard_dmainfo), GFP_KERNEL);
|
||||
p = kzalloc(sizeof(avmcard_dmainfo), GFP_KERNEL);
|
||||
if (!p) {
|
||||
printk(KERN_WARNING "%s: no memory.\n", name);
|
||||
goto err;
|
||||
}
|
||||
memset(p, 0, sizeof(avmcard_dmainfo));
|
||||
|
||||
p->recvbuf.size = rsize;
|
||||
buf = pci_alloc_consistent(pdev, rsize, &p->recvbuf.dmaaddr);
|
||||
|
||||
@@ -123,11 +123,10 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
|
||||
DEBUG(0, "avma1cs_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
p_dev->priv = local;
|
||||
|
||||
/* The io structure describes IO port mapping */
|
||||
|
||||
@@ -869,14 +869,13 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
|
||||
struct IsdnCard *card = cards + cardnr;
|
||||
struct IsdnCardState *cs;
|
||||
|
||||
cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
|
||||
cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
|
||||
if (!cs) {
|
||||
printk(KERN_WARNING
|
||||
"HiSax: No memory for IsdnCardState(card %d)\n",
|
||||
cardnr + 1);
|
||||
goto out;
|
||||
}
|
||||
memset(cs, 0, sizeof(struct IsdnCardState));
|
||||
card->cs = cs;
|
||||
spin_lock_init(&cs->statlock);
|
||||
spin_lock_init(&cs->lock);
|
||||
|
||||
@@ -146,9 +146,8 @@ static int elsa_cs_probe(struct pcmcia_device *link)
|
||||
DEBUG(0, "elsa_cs_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
|
||||
local->p_dev = link;
|
||||
link->priv = local;
|
||||
|
||||
@@ -26,12 +26,10 @@ FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
|
||||
int i;
|
||||
|
||||
fsm->jumpmatrix = (FSMFNPTR *)
|
||||
kmalloc(sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL);
|
||||
kzalloc(sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL);
|
||||
if (!fsm->jumpmatrix)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(fsm->jumpmatrix, 0, sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count);
|
||||
|
||||
for (i = 0; i < fncount; i++)
|
||||
if ((fnlist[i].state>=fsm->state_count) || (fnlist[i].event>=fsm->event_count)) {
|
||||
printk(KERN_ERR "FsmNew Error line %d st(%ld/%ld) ev(%ld/%ld)\n",
|
||||
|
||||
@@ -1591,11 +1591,10 @@ hfc4s8s_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
hfc4s8s_param *driver_data = (hfc4s8s_param *) ent->driver_data;
|
||||
hfc4s8s_hw *hw;
|
||||
|
||||
if (!(hw = kmalloc(sizeof(hfc4s8s_hw), GFP_ATOMIC))) {
|
||||
if (!(hw = kzalloc(sizeof(hfc4s8s_hw), GFP_ATOMIC))) {
|
||||
printk(KERN_ERR "No kmem for HFC-4S/8S card\n");
|
||||
return (err);
|
||||
}
|
||||
memset(hw, 0, sizeof(hfc4s8s_hw));
|
||||
|
||||
hw->pdev = pdev;
|
||||
err = pci_enable_device(pdev);
|
||||
|
||||
@@ -1481,9 +1481,8 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||
iface = iface_used;
|
||||
if (!
|
||||
(context =
|
||||
kmalloc(sizeof(hfcusb_data), GFP_KERNEL)))
|
||||
kzalloc(sizeof(hfcusb_data), GFP_KERNEL)))
|
||||
return (-ENOMEM); /* got no mem */
|
||||
memset(context, 0, sizeof(hfcusb_data));
|
||||
|
||||
ep = iface->endpoint;
|
||||
vcf = validconf[small_match];
|
||||
|
||||
@@ -841,12 +841,10 @@ new_adapter(void)
|
||||
struct hisax_b_if *b_if[2];
|
||||
int i;
|
||||
|
||||
adapter = kmalloc(sizeof(struct fritz_adapter), GFP_KERNEL);
|
||||
adapter = kzalloc(sizeof(struct fritz_adapter), GFP_KERNEL);
|
||||
if (!adapter)
|
||||
return NULL;
|
||||
|
||||
memset(adapter, 0, sizeof(struct fritz_adapter));
|
||||
|
||||
adapter->isac.hisax_d_if.owner = THIS_MODULE;
|
||||
adapter->isac.hisax_d_if.ifc.priv = &adapter->isac;
|
||||
adapter->isac.hisax_d_if.ifc.l2l1 = isac_d_l2l1;
|
||||
|
||||
@@ -155,9 +155,8 @@ static int sedlbauer_probe(struct pcmcia_device *link)
|
||||
DEBUG(0, "sedlbauer_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
|
||||
local->p_dev = link;
|
||||
|
||||
@@ -69,12 +69,10 @@ static int probe_st5481(struct usb_interface *intf,
|
||||
le16_to_cpu(dev->descriptor.idProduct),
|
||||
number_of_leds);
|
||||
|
||||
adapter = kmalloc(sizeof(struct st5481_adapter), GFP_KERNEL);
|
||||
adapter = kzalloc(sizeof(struct st5481_adapter), GFP_KERNEL);
|
||||
if (!adapter)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(adapter, 0, sizeof(struct st5481_adapter));
|
||||
|
||||
adapter->number_of_leds = number_of_leds;
|
||||
adapter->usb_dev = dev;
|
||||
|
||||
|
||||
@@ -137,9 +137,8 @@ static int teles_probe(struct pcmcia_device *link)
|
||||
DEBUG(0, "teles_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
|
||||
local->p_dev = link;
|
||||
|
||||
@@ -745,12 +745,11 @@ hycapi_capi_create(hysdn_card *card)
|
||||
return 1;
|
||||
}
|
||||
if (!card->hyctrlinfo) {
|
||||
cinfo = (hycapictrl_info *) kmalloc(sizeof(hycapictrl_info), GFP_ATOMIC);
|
||||
cinfo = kzalloc(sizeof(hycapictrl_info), GFP_ATOMIC);
|
||||
if (!cinfo) {
|
||||
printk(KERN_WARNING "HYSDN: no memory for capi-ctrl.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset(cinfo, 0, sizeof(hycapictrl_info));
|
||||
card->hyctrlinfo = cinfo;
|
||||
cinfo->card = card;
|
||||
spin_lock_init(&cinfo->lock);
|
||||
|
||||
@@ -278,14 +278,13 @@ pof_write_open(hysdn_card * card, unsigned char **bufp)
|
||||
return (-ERR_ALREADY_BOOT); /* boot already active */
|
||||
}
|
||||
/* error no mem available */
|
||||
if (!(boot = kmalloc(sizeof(struct boot_data), GFP_KERNEL))) {
|
||||
if (!(boot = kzalloc(sizeof(struct boot_data), GFP_KERNEL))) {
|
||||
if (card->debug_flags & LOG_MEM_ERR)
|
||||
hysdn_addlog(card, "POF open: unable to allocate mem");
|
||||
return (-EFAULT);
|
||||
}
|
||||
card->boot = boot;
|
||||
card->state = CARD_STATE_BOOTING;
|
||||
memset(boot, 0, sizeof(struct boot_data));
|
||||
|
||||
card->stopcard(card); /* first stop the card */
|
||||
if (card->testram(card)) {
|
||||
|
||||
@@ -81,11 +81,10 @@ search_cards(void)
|
||||
if (pci_enable_device(akt_pcidev))
|
||||
continue;
|
||||
|
||||
if (!(card = kmalloc(sizeof(hysdn_card), GFP_KERNEL))) {
|
||||
if (!(card = kzalloc(sizeof(hysdn_card), GFP_KERNEL))) {
|
||||
printk(KERN_ERR "HYSDN: unable to alloc device mem \n");
|
||||
return;
|
||||
}
|
||||
memset(card, 0, sizeof(hysdn_card));
|
||||
card->myid = cardmax; /* set own id */
|
||||
card->bus = akt_pcidev->bus->number;
|
||||
card->devfn = akt_pcidev->devfn; /* slot + function */
|
||||
|
||||
@@ -278,11 +278,10 @@ hysdn_net_create(hysdn_card * card)
|
||||
return (-ENOMEM);
|
||||
}
|
||||
hysdn_net_release(card); /* release an existing net device */
|
||||
if ((dev = kmalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) {
|
||||
if ((dev = kzalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) {
|
||||
printk(KERN_WARNING "HYSDN: unable to allocate mem\n");
|
||||
return (-ENOMEM);
|
||||
}
|
||||
memset(dev, 0, sizeof(struct net_local)); /* clean the structure */
|
||||
|
||||
spin_lock_init(&((struct net_local *) dev)->lock);
|
||||
|
||||
|
||||
@@ -405,8 +405,7 @@ hysdn_proclog_init(hysdn_card * card)
|
||||
|
||||
/* create a cardlog proc entry */
|
||||
|
||||
if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
|
||||
memset(pd, 0, sizeof(struct procdata));
|
||||
if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
|
||||
sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
|
||||
if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) {
|
||||
pd->log->proc_fops = &log_fops;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user