Skip to contentSkip to conversation

cs53l32a: kzalloc conversion

PATCH In review Panagiotis Issaris 3 participants 3 messages Jan 3, 2006 – Jan 5, 2006 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cs53l32a: kzalloc conversion

From: Panagiotis Issaris <[email protected]>

Conversion of kmalloc+memset to kzalloc.

---

 drivers/media/video/cs53l32a.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

d27ad6f2f4c46ed0b29034c413cc8f948506fdc6

drivers/media/video/cs53l32a.c +1 -2
index 780b352..f9e3b8b 100644
@@ -146,11 +146,10 @@ static int cs53l32a_attach(struct i2c_ad
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
 		return 0;
 
-	client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+	client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
 	if (client == 0)
 		return -ENOMEM;
 
-	memset(client, 0, sizeof(struct i2c_client));
 	client->addr = address;
 	client->adapter = adapter;
 	client->driver = &i2c_driver;
Signature · 1 line
0.99.9.GIT
#1 lore raw
Quoted 20 lines · [email protected] (Panagiotis Issaris) wrote:

From: Panagiotis Issaris <[email protected]>

Conversion of kmalloc+memset to kzalloc.

---

 drivers/media/video/cs53l32a.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

d27ad6f2f4c46ed0b29034c413cc8f948506fdc6

drivers/media/video/cs53l32a.c +0 -0
index 780b352..f9e3b8b 100644
@@ -146,11 +146,10 @@ static int cs53l32a_attach(struct i2c_ad
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
 		return 0;

drivers/media/video/cs53l32a.c static int cs53l32a_attach(struct i2c_ad · line 155

Quoted 10 lines
drivers/media/video/cs53l32a.c +1 -2
 
-	client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+	client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
 	if (client == 0)
 		return -ENOMEM;
 
-	memset(client, 0, sizeof(struct i2c_client));
 	client->addr = address;
 	client->adapter = adapter;
 	client->driver = &i2c_driver;

A quick grep shows that there are ~60 kmalloc+memsets under drivers/media/video. So I'd prefer that if we're going to do this, we do it all in one big hit rather than merging a dribble of little patches.

If someone does this, please also remove the typecasts of the kmalloc/kzalloc return value, such as

drivers/media/video/mxb.c: mxb = (struct mxb*)kmalloc(sizeof(struct mxb), GFP_KERNEL);

#2 lore raw

Hi,

2006/1/5, Andrew Morton <[email protected]>:

Quoted 5 lines
Quoted 2 lines
 drivers/media/video/cs53l32a.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

A quick grep shows that there are ~60 kmalloc+memsets under drivers/media/video. So I'd prefer that if we're going to do this, we do it all in one big hit rather than merging a dribble of little patches.

Sure, prepared two patches yesterday night doing the drivers/media and net/ directories. I've sent the drivers/media patch earlier today and will review and submit the net/ patch this evening.

With friendly regards,
Takis