kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sesterhenn <snakebyte@gmx.de>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [Patch] kmemdup() cleanup in drivers/media/video
Date: Mon, 23 Oct 2006 20:18:23 +0000	[thread overview]
Message-ID: <1161634704.419.9.camel@alice> (raw)
In-Reply-To: <1161634468.419.1.camel@alice>

hi,

replace open coded kmemdup() to save some screen space,
and allow inlining/not inlining to be triggered by gcc.

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

--- linux-2.6.19-rc2-git7/drivers/media/video/ovcamchip/ovcamchip_core.c.orig	2006-10-23 21:13:43.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/media/video/ovcamchip/ovcamchip_core.c	2006-10-23 21:14:04.000000000 +0200
@@ -307,12 +307,11 @@ static int ovcamchip_attach(struct i2c_a
 		return -ENODEV;
 	}
 
-	c = kmalloc(sizeof *c, GFP_KERNEL);
+	c = kmemdup(&client_template, sizeof *c, GFP_KERNEL);
 	if (!c) {
 		rc = -ENOMEM;
 		goto no_client;
 	}
-	memcpy(c, &client_template, sizeof *c);
 	c->adapter = adap;
 	strcpy(c->name, "OV????");
 
--- linux-2.6.19-rc2-git7/drivers/media/video/pvrusb2/pvrusb2-io.c.orig	2006-10-23 21:15:34.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/media/video/pvrusb2/pvrusb2-io.c	2006-10-23 21:16:17.000000000 +0200
@@ -351,9 +351,8 @@ static int pvr2_stream_buffer_count(stru
 		if (scnt < sp->buffer_slot_count) {
 			struct pvr2_buffer **nb = NULL;
 			if (scnt) {
-				nb = kmalloc(scnt * sizeof(*nb),GFP_KERNEL);
+				nb = kmemdup(sp->buffers, scnt * sizeof(*nb),GFP_KERNEL);
 				if (!nb) return -ENOMEM;
-				memcpy(nb,sp->buffers,scnt * sizeof(*nb));
 			}
 			kfree(sp->buffers);
 			sp->buffers = nb;
--- linux-2.6.19-rc2-git7/drivers/media/video/saa5246a.c.orig	2006-10-23 21:16:46.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/media/video/saa5246a.c	2006-10-23 21:17:19.000000000 +0200
@@ -80,12 +80,11 @@ static int saa5246a_attach(struct i2c_ad
 	struct saa5246a_device *t;
 
 	printk(KERN_INFO "saa5246a: teletext chip found.\n");
-	client=kmalloc(sizeof(*client), GFP_KERNEL);
+	client=kmemdup(&client_template, sizeof(*client), GFP_KERNEL);
 	if(client=NULL)
 		return -ENOMEM;
 	client_template.adapter = adap;
 	client_template.addr = addr;
-	memcpy(client, &client_template, sizeof(*client));
 	t = kzalloc(sizeof(*t), GFP_KERNEL);
 	if(t=NULL)
 	{
--- linux-2.6.19-rc2-git7/drivers/media/video/tuner-3036.c.orig	2006-10-23 21:18:30.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/media/video/tuner-3036.c	2006-10-23 21:18:44.000000000 +0200
@@ -121,10 +121,9 @@ tuner_attach(struct i2c_adapter *adap, i
 	client_template.adapter = adap;
 	client_template.addr = addr;
 
-	client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+	client = kmemdup(&client_template, sizeof(struct i2c_client), GFP_KERNEL);
 	if (client = NULL)
 		return -ENOMEM;
-	memcpy(client, &client_template, sizeof(struct i2c_client));
 
 	printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client));
 
--- linux-2.6.19-rc2-git7/drivers/media/video/tvp5150.c.orig	2006-10-23 21:19:27.000000000 +0200
+++ linux-2.6.19-rc2-git7/drivers/media/video/tvp5150.c	2006-10-23 21:19:43.000000000 +0200
@@ -1066,10 +1066,9 @@ static int tvp5150_detect_client(struct 
 	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
 		return 0;
 
-	c = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+	c = kmemdup(&client_template, sizeof(struct i2c_client), GFP_KERNEL);
 	if (c = 0)
 		return -ENOMEM;
-	memcpy(c, &client_template, sizeof(struct i2c_client));
 
 	core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL);
 	if (core = 0) {


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

  parent reply	other threads:[~2006-10-23 20:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-23 20:14 [KJ] [Patch] kmemdup() cleanup in drivers/acpi/ Eric Sesterhenn
2006-10-23 20:15 ` [KJ] [Patch] kmemdup() cleanup in drivers/base Eric Sesterhenn
2006-10-23 20:16 ` [KJ] [Patch] kmemdup() cleanup in drivers/ieee1394 Eric Sesterhenn
2006-10-23 20:17 ` [KJ] [Patch] kmemdup() cleanup in drivers/infiniband Eric Sesterhenn
2006-10-23 20:18 ` Eric Sesterhenn [this message]
2006-10-23 20:19 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Eric Sesterhenn
2006-10-23 20:20 ` [KJ] [Patch] kmemdup() cleanup in drivers/net Eric Sesterhenn
2006-10-23 20:21 ` [KJ] [Patch] kmemdup() cleanup in drivers/parport Eric Sesterhenn
2006-10-23 20:22 ` [KJ] [Patch] kmemdup() cleanup in drivers/pci/ Eric Sesterhenn
2006-10-23 20:42 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Matthew Wilcox
2006-10-24  3:05 ` [KJ] [Patch] kmemdup() cleanup in drivers/infiniband Roland Dreier
2006-10-24  8:26 ` [KJ] [Patch] kmemdup() cleanup in drivers/pci/ Alexey Dobriyan
2006-10-24 14:53 ` Eric Sesterhenn / Snakebyte
2006-10-24 16:36 ` walter harms
2006-10-24 17:51 ` Alexey Dobriyan
2006-10-24 18:09 ` Matthew Wilcox
2006-10-26 19:04 ` [KJ] [Patch] kmemdup() cleanup in drivers/scsi Eric Sesterhenn
2006-10-26 19:07 ` [KJ] [Patch] kmemdup() cleanup in drivers/video/ Eric Sesterhenn
2006-10-29 19:00 ` [KJ] [Patch] kmemdup() cleanup in drivers/media/video Alexey Dobriyan
2006-10-29 19:02 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Alexey Dobriyan
2006-11-06  8:13 ` [KJ] [Patch] kmemdup() cleanup in drivers/net Jeff Garzik

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=1161634704.419.9.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).