Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7408187d authored by Panagiotis Issaris's avatar Panagiotis Issaris Committed by Mauro Carvalho Chehab
Browse files



V4L/DVB (3344a): Conversions from kmalloc+memset to k(z|c)alloc


Conversions from kmalloc+memset to k(z|c)alloc.

Signed-off-by: default avatarPanagiotis Issaris <takis@issaris.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 0b3af1b6
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -109,10 +109,9 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
	struct page *pg;
	int i;

	sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL);
	sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
	if (NULL == sglist)
		return NULL;
	memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
	for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
		pg = vmalloc_to_page(virt);
		if (NULL == pg)
@@ -306,15 +305,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
	struct saa7146_dev *dev;
	int err = -ENOMEM;

	dev = kmalloc(sizeof(struct saa7146_dev), GFP_KERNEL);
	/* clear out mem for sure */
	dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL);
	if (!dev) {
		ERR(("out of memory.\n"));
		goto out;
	}

	/* clear out mem for sure */
	memset(dev, 0x0, sizeof(struct saa7146_dev));

	DEB_EE(("pci:%p\n",pci));

	err = pci_enable_device(pci);
+2 −4
Original line number Diff line number Diff line
@@ -239,13 +239,12 @@ static int fops_open(struct inode *inode, struct file *file)
	}

	/* allocate per open data */
	fh = kmalloc(sizeof(*fh),GFP_KERNEL);
	fh = kzalloc(sizeof(*fh),GFP_KERNEL);
	if (NULL == fh) {
		DEB_S(("cannot allocate memory for per open data.\n"));
		result = -ENOMEM;
		goto out;
	}
	memset(fh,0,sizeof(*fh));

	file->private_data = fh;
	fh->dev = dev;
@@ -464,12 +463,11 @@ static struct video_device device_template =

int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
{
	struct saa7146_vv *vv = kmalloc (sizeof(struct saa7146_vv),GFP_KERNEL);
	struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL);
	if( NULL == vv ) {
		ERR(("out of memory. aborting.\n"));
		return -1;
	}
	memset(vv, 0x0, sizeof(*vv));

	DEB_EE(("dev:%p\n",dev));

+2 −4
Original line number Diff line number Diff line
@@ -220,20 +220,18 @@ EXPORT_SYMBOL(flexcop_reset_block_300);
struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len)
{
	void *bus;
	struct flexcop_device *fc = kmalloc(sizeof(struct flexcop_device), GFP_KERNEL);
	struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL);
	if (!fc) {
		err("no memory");
		return NULL;
	}
	memset(fc, 0, sizeof(struct flexcop_device));

	bus = kmalloc(bus_specific_len, GFP_KERNEL);
	bus = kzalloc(bus_specific_len, GFP_KERNEL);
	if (!bus) {
		err("no memory");
		kfree(fc);
		return NULL;
	}
	memset(bus, 0, bus_specific_len);

	fc->bus_specific = bus;

+1 −2
Original line number Diff line number Diff line
@@ -786,10 +786,9 @@ static int dvb_bt8xx_probe(struct device *dev)
	struct pci_dev* bttv_pci_dev;
	int ret;

	if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL)))
	if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL)))
		return -ENOMEM;

	memset(card, 0, sizeof(*card));
	init_MUTEX(&card->lock);
	card->bttv_nr = sub->core->nr;
	strncpy(card->card_name, sub->core->name, sizeof(sub->core->name));
+2 −6
Original line number Diff line number Diff line
@@ -1649,21 +1649,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
		return -EINVAL;

	/* initialise the system data */
	if ((ca =
	     (struct dvb_ca_private *) kmalloc(sizeof(struct dvb_ca_private),
					       GFP_KERNEL)) == NULL) {
	if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) {
		ret = -ENOMEM;
		goto error;
	}
	memset(ca, 0, sizeof(struct dvb_ca_private));
	ca->pub = pubca;
	ca->flags = flags;
	ca->slot_count = slot_count;
	if ((ca->slot_info = kmalloc(sizeof(struct dvb_ca_slot) * slot_count, GFP_KERNEL)) == NULL) {
	if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) {
		ret = -ENOMEM;
		goto error;
	}
	memset(ca->slot_info, 0, sizeof(struct dvb_ca_slot) * slot_count);
	init_waitqueue_head(&ca->wait_queue);
	ca->thread_pid = 0;
	init_waitqueue_head(&ca->thread_queue);
Loading