All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sesterhenn <snakebyte@gmx.de>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [Patch] kzalloc() conversion in drivers/sbus
Date: Sun, 05 Mar 2006 08:41:36 +0000	[thread overview]
Message-ID: <1141548096.6426.6.camel@alice> (raw)
In-Reply-To: <1140815848.26064.4.camel@alice>

[-- Attachment #1: Type: text/plain, Size: 4116 bytes --]

hi,  

this patch converts drivers/sbus to kzalloc usage.
Not tested

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.16-rc5-mm1/drivers/sbus/char/bbc_envctrl.c.orig	2006-03-04 21:59:51.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/sbus/char/bbc_envctrl.c	2006-03-04 22:00:20.000000000 +0100
@@ -485,11 +485,10 @@ static int kenvctrld(void *__unused)
 
 static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx)
 {
-	struct bbc_cpu_temperature *tp = kmalloc(sizeof(*tp), GFP_KERNEL);
+	struct bbc_cpu_temperature *tp = kzalloc(sizeof(*tp), GFP_KERNEL);
 
 	if (!tp)
 		return;
-	memset(tp, 0, sizeof(*tp));
 	tp->client = bbc_i2c_attach(echild);
 	if (!tp->client) {
 		kfree(tp);
@@ -531,11 +530,10 @@ static void attach_one_temp(struct linux
 
 static void attach_one_fan(struct linux_ebus_child *echild, int fan_idx)
 {
-	struct bbc_fan_control *fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+	struct bbc_fan_control *fp = kzalloc(sizeof(*fp), GFP_KERNEL);
 
 	if (!fp)
 		return;
-	memset(fp, 0, sizeof(*fp));
 	fp->client = bbc_i2c_attach(echild);
 	if (!fp->client) {
 		kfree(fp);
--- linux-2.6.16-rc5-mm1/drivers/sbus/char/openprom.c.orig	2006-03-04 22:00:31.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/sbus/char/openprom.c	2006-03-04 22:01:41.000000000 +0100
@@ -87,9 +87,8 @@ static int copyin(struct openpromio __us
 	if (bufsize > OPROMMAXPARAM)
 		bufsize = OPROMMAXPARAM;
 
-	if (!(*opp_p = kmalloc(sizeof(int) + bufsize + 1, GFP_KERNEL)))
+	if (!(*opp_p = kzalloc(sizeof(int) + bufsize + 1, GFP_KERNEL)))
 		return -ENOMEM;
-	memset(*opp_p, 0, sizeof(int) + bufsize + 1);
 
 	if (copy_from_user(&(*opp_p)->oprom_array,
 			   &info->oprom_array, bufsize)) {
@@ -107,10 +106,9 @@ static int getstrings(struct openpromio 
 	if (!info || !opp_p)
 		return -EFAULT;
 
-	if (!(*opp_p = kmalloc(sizeof(int) + OPROMMAXPARAM + 1, GFP_KERNEL)))
+	if (!(*opp_p = kzalloc(sizeof(int) + OPROMMAXPARAM + 1, GFP_KERNEL)))
 		return -ENOMEM;
 
-	memset(*opp_p, 0, sizeof(int) + OPROMMAXPARAM + 1);
 	(*opp_p)->oprom_size = 0;
 
 	n = bufsize = 0;
--- linux-2.6.16-rc5-mm1/drivers/sbus/char/bbc_i2c.c.orig	2006-03-04 22:02:02.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/sbus/char/bbc_i2c.c	2006-03-04 22:02:33.000000000 +0100
@@ -155,10 +155,9 @@ struct bbc_i2c_client *bbc_i2c_attach(st
 
 	if (!bp)
 		return NULL;
-	client = kmalloc(sizeof(*client), GFP_KERNEL);
+	client = kzalloc(sizeof(*client), GFP_KERNEL);
 	if (!client)
 		return NULL;
-	memset(client, 0, sizeof(*client));
 	client->bp = bp;
 	client->echild = echild;
 	client->bus = echild->resource[0].start;
@@ -356,13 +355,12 @@ static void __init reset_one_i2c(struct 
 
 static int __init attach_one_i2c(struct linux_ebus_device *edev, int index)
 {
-	struct bbc_i2c_bus *bp = kmalloc(sizeof(*bp), GFP_KERNEL);
+	struct bbc_i2c_bus *bp = kzalloc(sizeof(*bp), GFP_KERNEL);
 	struct linux_ebus_child *echild;
 	int entry;
 
 	if (!bp)
 		return -ENOMEM;
-	memset(bp, 0, sizeof(*bp));
 
 	bp->i2c_control_regs = ioremap(edev->resource[0].start, 0x2);
 	if (!bp->i2c_control_regs)
--- linux-2.6.16-rc5-mm1/drivers/sbus/char/vfc_dev.c.orig	2006-03-04 22:02:42.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/sbus/char/vfc_dev.c	2006-03-04 22:03:31.000000000 +0100
@@ -264,11 +264,10 @@ static int vfc_debug(struct vfc_dev *dev
 		if (copy_from_user(&inout, argp, sizeof(inout)))
 			return -EFAULT;
 
-		buffer = kmalloc(inout.len, GFP_KERNEL);
+		buffer = kzalloc(inout.len, GFP_KERNEL);
 		if (buffer == NULL)
 			return -ENOMEM;
 
-		memset(buffer,0,inout.len);
 		vfc_lock_device(dev);
 		inout.ret=
 			vfc_i2c_recvbuf(dev,inout.addr & 0xff
@@ -663,12 +662,9 @@ static int vfc_probe(void)
 	if (!cards)
 		return -ENODEV;
 
-	vfc_dev_lst = (struct vfc_dev **)kmalloc(sizeof(struct vfc_dev *) *
-						 (cards+1),
-						 GFP_KERNEL);
+	vfc_dev_lst = kcalloc((cards+1), sizeof(struct vfc_dev *), GFP_KERNEL);
 	if (vfc_dev_lst == NULL)
 		return -ENOMEM;
-	memset(vfc_dev_lst, 0, sizeof(struct vfc_dev *) * (cards + 1));
 	vfc_dev_lst[cards] = NULL;
 
 	ret = register_chrdev(VFC_MAJOR, vfcstr, &vfc_fops);



[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2006-03-05  8:41 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24 21:17 [KJ] [Patch] kzalloc() conversion in drivers/video Eric Sesterhenn
2006-02-27  9:22 ` [KJ] [Patch] kzalloc() conversion in drivers/atm Eric Sesterhenn
2006-02-27  9:43 ` Tobias Klauser
2006-02-27 11:16 ` Eric Sesterhenn
2006-02-27 16:22 ` [KJ] [Patch] kzalloc() conversion in drivers/usb Eric Sesterhenn
2006-02-27 20:36 ` [KJ] [Patch] kzalloc() conversion in drivers/usb/gadget Eric Sesterhenn
2006-02-27 20:51 ` Jesper Juhl
2006-02-28 13:54 ` [KJ] [Patch] kzalloc() conversion in drivers/acpi Eric Sesterhenn
2006-02-28 13:54 ` [KJ] [Patch] kzalloc() conversion in drivers/s390 Eric Sesterhenn
2006-02-28 14:34 ` [KJ] [Patch] kzalloc() conversion in drivers/pci Eric Sesterhenn
2006-02-28 21:39 ` [KJ] [Patch] kzalloc() conversion in drivers/usb/gadget Alexey Dobriyan
2006-02-28 21:49 ` Jesper Juhl
2006-03-01  9:00 ` [KJ] [Patch] kzalloc() conversion in drivers/char Eric Sesterhenn
2006-03-01 23:29 ` [KJ] [Patch] kzalloc() conversion in drivers/mtd Eric Sesterhenn
2006-03-02 11:58 ` [KJ] [Patch] kzalloc() conversion in drivers/serial Eric Sesterhenn
2006-03-04 17:56 ` [KJ] [Patch] kzalloc() conversion in drivers/net Eric Sesterhenn
2006-03-04 17:56   ` Eric Sesterhenn
2006-03-04 19:09 ` [KJ] [Patch] kzalloc() conversion in drivers/md Eric Sesterhenn
2006-03-04 19:09 ` [KJ] [Patch] kzalloc() conversion in drivers/macintosh Eric Sesterhenn
2006-03-04 19:09 ` [KJ] [Patch] kzalloc() conversion in drivers/block Eric Sesterhenn
2006-03-05  8:41 ` Eric Sesterhenn [this message]
2006-03-05 15:02 ` [KJ] [Patch] kzalloc() conversion in drivers/telephony/ Eric Sesterhenn
2006-03-05 15:02 ` [KJ] [Patch] kzalloc() conversion in drivers/rapidio Eric Sesterhenn
2006-03-05 15:02 ` [KJ] [Patch] kzalloc() conversion in drivers/misc/ Eric Sesterhenn
2006-03-05 15:02 ` [KJ] [Patch] kzalloc() conversion in drivers/mfd/ Eric Sesterhenn
2006-03-05 15:02 ` [KJ] [Patch] kzalloc() conversion in drivers/media/ Eric Sesterhenn
2006-03-05 15:02 ` [KJ] [Patch] kzalloc() conversion in drivers/block Eric Sesterhenn
2006-03-05 21:02 ` [KJ] [Patch] kzalloc() conversion in drivers/sh Eric Sesterhenn
2006-03-05 21:02 ` [KJ] [Patch] kzalloc() conversion in drivers/pnp Eric Sesterhenn
2006-03-05 21:02 ` [KJ] [Patch] kzalloc() conversion in drivers/nubus Eric Sesterhenn
2006-03-05 21:02 ` [KJ] [Patch] kzalloc() conversion in drivers/mca Eric Sesterhenn
2006-03-05 21:02 ` [KJ] [Patch] kzalloc() conversion in drivers/message Eric Sesterhenn
2006-03-05 21:02 ` [KJ] [Patch] kzalloc() conversion in drivers/acorn/ Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in drivers/parport/ Eric Sesterhenn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1141548096.6426.6.camel@alice \
    --to=snakebyte@gmx.de \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.