comedi_subdevice *s;
- tmp=kmalloc(dev->n_subdevices*sizeof(comedi_subdinfo),GFP_KERNEL);
+ tmp=kcalloc(dev->n_subdevices,sizeof(comedi_subdinfo),GFP_KERNEL);
if(!tmp)
return -ENOMEM;
- memset(tmp,0,sizeof(comedi_subdinfo)*dev->n_subdevices);
-
/* fill subdinfo structs */
for(i=0;i<dev->n_subdevices;i++){
s=dev->subdevices+i;
cdev_del(&comedi_cdev);
return PTR_ERR(comedi_class);
}
- comedi_devices=(comedi_device *)kmalloc(sizeof(comedi_device)*COMEDI_NDEVICES,GFP_KERNEL);
+ comedi_devices=kcalloc(COMEDI_NDEVICES,sizeof(comedi_device),GFP_KERNEL);
if(!comedi_devices)
{
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS);
class_destroy(comedi_class);
return -ENOMEM;
}
- memset(comedi_devices,0,sizeof(comedi_device)*COMEDI_NDEVICES);
/* XXX requires /proc interface */
comedi_proc_init();
BUG_ON((s->subdev_flags & (SDF_CMD_READ | SDF_CMD_WRITE)) == 0);
BUG_ON(!s->do_cmdtest);
- async = kmalloc(sizeof(comedi_async), GFP_KERNEL);
+ async = kzalloc(sizeof(comedi_async), GFP_KERNEL);
if(async == NULL)
{
printk("failed to allocate async struct\n");
return -ENOMEM;
}
- memset(async, 0, sizeof(comedi_async));
async->subdevice = s;
s->async = async;
{
dio200_subdev_intr *subpriv;
- subpriv = kmalloc(sizeof(*subpriv), GFP_KERNEL);
+ subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL);
if (!subpriv) {
printk(KERN_ERR "comedi%d: error! out of memory!\n", dev->minor);
return -ENOMEM;
}
- memset(subpriv, 0, sizeof(*subpriv));
subpriv->iobase = iobase;
subpriv->has_int_sce = has_int_sce;
subpriv->valid_isns = valid_isns;
dio200_subdev_8254 *subpriv;
unsigned int chan;
- subpriv = kmalloc(sizeof(*subpriv), GFP_KERNEL);
+ subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL);
if (!subpriv) {
printk(KERN_ERR "comedi%d: error! out of memory!\n", dev->minor);
return -ENOMEM;
}
- memset(subpriv, 0, sizeof(*subpriv));
s->private = subpriv;
s->type = COMEDI_SUBD_COUNTER;
DEBUG(0, "das16cs_pcmcia_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->link = link;
link->priv = local;
start_rt_timer( 1 );
devpriv->timer_running = 1;
- devpriv->rt_task = kmalloc(sizeof(RT_TASK),GFP_KERNEL);
- memset(devpriv->rt_task,0,sizeof(RT_TASK));
+ devpriv->rt_task = kzalloc(sizeof(RT_TASK),GFP_KERNEL);
// initialize real-time tasks
ret = rt_task_init(devpriv->rt_task, timer_task_func,(int)dev, 3000,
return ret;
}
- devpriv->scan_task = kmalloc(sizeof(RT_TASK),GFP_KERNEL);
- memset(devpriv->scan_task,0,sizeof(RT_TASK));
+ devpriv->scan_task = kzalloc(sizeof(RT_TASK),GFP_KERNEL);
ret = rt_task_init(devpriv->scan_task, scan_task_func,
(int)dev, 3000, scan_priority, 0, 0);
DEBUG(0, "das08_pcmcia_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->link = link;
link->priv = local;
u8 fw;
// allocate memory for our device state and initialize it
- dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) {
err("Out of memory");
goto error;
}
- memset(dev, 0x00, sizeof(*dev));
KREF_INIT(&dev->kref, dt9812_delete);
dev->udev = usb_get_dev(interface_to_usbdev(interface));
dev->subdevices[i].subdev_flags = SDF_READABLE|SDF_GROUND;
dev->subdevices[i].n_chan = 8 * 7 + 2;
dev->subdevices[i].insn_read = jr3_pci_ai_insn_read;
- dev->subdevices[i].private = kmalloc(sizeof(jr3_pci_subdev_private),
+ dev->subdevices[i].private = kzalloc(sizeof(jr3_pci_subdev_private),
GFP_KERNEL);
if (dev->subdevices[i].private) {
jr3_pci_subdev_private *p;
int j;
p = dev->subdevices[i].private;
- memset(p, 0, sizeof(*p));
p->channel = &devpriv->iobase->channel[i].data;
printk("p->channel %p %p (%x)\n",
p->channel, devpriv->iobase,
if(pcidev->vendor==PCI_VENDOR_ID_NATINST){
unsigned i;
- mite=kmalloc(sizeof(*mite),GFP_KERNEL);
+ mite=kzalloc(sizeof(*mite),GFP_KERNEL);
if(!mite){
printk("mite: allocation failed\n");
pci_dev_put(pcidev);
return;
}
- memset(mite,0,sizeof(*mite));
spin_lock_init(&mite->lock);
mite->pcidev=pci_dev_get(pcidev);
for(i = 0; i < MAX_MITE_DMA_CHANNELS; ++i)
}
static ni_65xx_subdevice_private* ni_65xx_alloc_subdevice_private(void)
{
- ni_65xx_subdevice_private *subdev_private = kmalloc(sizeof(ni_65xx_subdevice_private), GFP_KERNEL);
+ ni_65xx_subdevice_private *subdev_private = kzalloc(sizeof(ni_65xx_subdevice_private), GFP_KERNEL);
if(subdev_private == NULL) return NULL;
- memset(subdev_private, 0, sizeof(ni_65xx_subdevice_private));
return subdev_private;
}
DEBUG(0, "dio24_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->link = link; link->priv = local;
/* Interrupt setup */
DEBUG(0, "labpc_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->link = link; link->priv = local;
/* Interrupt setup */
return -ENOMEM;
}
- memset(devpriv, 0, sizeof(*devpriv));
-
devpriv->simultaneous_xfer_mode = it->options[1];
/*
}
/* 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->table_index = i;
dev_table[i] = local;
return -EIO;
}
- if((usp = (unioxx5_subd_priv*)kmalloc(sizeof(*usp), GFP_KERNEL)) == NULL) {
+ if((usp = (unioxx5_subd_priv*)kzalloc(sizeof(*usp), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "comedi%d: erorr! --> out of memory!\n", minor);
return -1;
}
- memset(usp, 0, sizeof(*usp));
usp->usp_iobase = subdev_iobase;
printk("comedi%d: |", minor);
return PROBE_ERR_RETURN( -ENOMEM);
}
- // create space for the in buffer
- usbduxsub[index].inBuffer=kmalloc(SIZEINBUF,GFP_KERNEL);
+ // create space for the in buffer and zero it
+ usbduxsub[index].inBuffer=kzalloc(SIZEINBUF,GFP_KERNEL);
if (!(usbduxsub[index].inBuffer)) {
printk("comedi_: usbdux: could not alloc space for inBuffer\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
return PROBE_ERR_RETURN( -ENOMEM);
}
- // set the buffer to zero
- memset(usbduxsub[index].inBuffer,0,SIZEINBUF);
// create space of the instruction buffer
usbduxsub[index].insnBuffer=kmalloc(SIZEINSNBUF,GFP_KERNEL);
return PROBE_ERR_RETURN( -ENOMEM);
}
- // create space for the outbuffer
- usbduxsub[index].outBuffer=kmalloc(SIZEOUTBUF,GFP_KERNEL);
+ // create space for the outbuffer and zero it
+ usbduxsub[index].outBuffer=kzalloc(SIZEOUTBUF,GFP_KERNEL);
if (!(usbduxsub[index].outBuffer)) {
printk("comedi_: usbdux: could not alloc space for outBuffer\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
return PROBE_ERR_RETURN( -ENOMEM);
}
- // set the buffer to zero
- memset(usbduxsub[index].outBuffer,0,SIZEOUTBUF);
}
}else
{
- it = kmalloc(sizeof(struct comedi_irq_struct), GFP_KERNEL);
+ it = kzalloc(sizeof(struct comedi_irq_struct), GFP_KERNEL);
if(!it)
return -ENOMEM;
- memset(it, 0, sizeof(struct comedi_irq_struct));
it->handler=handler;
it->irq=irq;
static inline int alloc_subdevices(comedi_device *dev, unsigned int num_subdevices)
{
- const int size = sizeof(comedi_subdevice) * num_subdevices;
unsigned i;
dev->n_subdevices = num_subdevices;
- dev->subdevices = kmalloc(size,GFP_KERNEL);
+ dev->subdevices = kcalloc(num_subdevices,sizeof(comedi_subdevice),GFP_KERNEL);
if(!dev->subdevices)
return -ENOMEM;
- memset(dev->subdevices,0,size);
for(i = 0; i < num_subdevices; ++i)
{
dev->subdevices[i].device = dev;
static inline int alloc_private(comedi_device *dev,int size)
{
- dev->private=kmalloc(size,GFP_KERNEL);
+ dev->private=kzalloc(size,GFP_KERNEL);
if(!dev->private)
return -ENOMEM;
- memset(dev->private,0,size);
return 0;
}