summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-02-23 15:26:38 +0000
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-02-23 15:26:38 +0000
commitf1b096388308b69fdc4fe54e5952a7f7beb845bb (patch)
treeb38d26e402f75e70100185d80ff7b41f2b594dc5 /linux
parente24be1d8a703d1ebcc4b2027be8071d82446b2b3 (diff)
downloadmediapointer-dvb-s2-f1b096388308b69fdc4fe54e5952a7f7beb845bb.tar.gz
mediapointer-dvb-s2-f1b096388308b69fdc4fe54e5952a7f7beb845bb.tar.bz2
remove redundant memset after kzalloc
From: Matthias Schwarzott <zzam@gentoo.org> Hi there! While having a look at the allocation of struct dvb_frontend in *_attach functions, I found some cases calling memset after kzalloc. This is redundant, and the attached patch removes these calls. I also changed one case calling kmalloc and memset to kzalloc. Regards Matthias Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/frontends/cx24113.c2
-rw-r--r--linux/drivers/media/dvb/frontends/cx24116.c5
-rw-r--r--linux/drivers/media/dvb/frontends/cx24123.c4
-rw-r--r--linux/drivers/media/dvb/frontends/lgdt3304.c1
-rw-r--r--linux/drivers/media/dvb/frontends/s921_module.c1
5 files changed, 4 insertions, 9 deletions
diff --git a/linux/drivers/media/dvb/frontends/cx24113.c b/linux/drivers/media/dvb/frontends/cx24113.c
index f6e7b0380..e4fd533a4 100644
--- a/linux/drivers/media/dvb/frontends/cx24113.c
+++ b/linux/drivers/media/dvb/frontends/cx24113.c
@@ -559,7 +559,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
kzalloc(sizeof(struct cx24113_state), GFP_KERNEL);
int rc;
if (state == NULL) {
- err("Unable to kmalloc\n");
+ err("Unable to kzalloc\n");
goto error;
}
diff --git a/linux/drivers/media/dvb/frontends/cx24116.c b/linux/drivers/media/dvb/frontends/cx24116.c
index 8301a9865..b5ff0b6a8 100644
--- a/linux/drivers/media/dvb/frontends/cx24116.c
+++ b/linux/drivers/media/dvb/frontends/cx24116.c
@@ -1112,13 +1112,10 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config,
dprintk("%s\n", __func__);
/* allocate memory for the internal state */
- state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL);
+ state = kzalloc(sizeof(struct cx24116_state), GFP_KERNEL);
if (state == NULL)
goto error1;
- /* setup the state */
- memset(state, 0, sizeof(struct cx24116_state));
-
state->config = config;
state->i2c = i2c;
diff --git a/linux/drivers/media/dvb/frontends/cx24123.c b/linux/drivers/media/dvb/frontends/cx24123.c
index c9cfc8393..f431f0c56 100644
--- a/linux/drivers/media/dvb/frontends/cx24123.c
+++ b/linux/drivers/media/dvb/frontends/cx24123.c
@@ -1084,13 +1084,13 @@ static struct dvb_frontend_ops cx24123_ops;
struct dvb_frontend *cx24123_attach(const struct cx24123_config *config,
struct i2c_adapter *i2c)
{
+ /* allocate memory for the internal state */
struct cx24123_state *state =
kzalloc(sizeof(struct cx24123_state), GFP_KERNEL);
dprintk("\n");
- /* allocate memory for the internal state */
if (state == NULL) {
- err("Unable to kmalloc\n");
+ err("Unable to kzalloc\n");
goto error;
}
diff --git a/linux/drivers/media/dvb/frontends/lgdt3304.c b/linux/drivers/media/dvb/frontends/lgdt3304.c
index d56a799d3..3a4a18970 100644
--- a/linux/drivers/media/dvb/frontends/lgdt3304.c
+++ b/linux/drivers/media/dvb/frontends/lgdt3304.c
@@ -383,7 +383,6 @@ struct dvb_frontend* lgdt3304_attach(const struct lgdt3304_config *config,
struct lgdt3304_state *state;
state = kzalloc(sizeof(struct lgdt3304_state), GFP_KERNEL);
- memset(state, 0x0, sizeof(struct lgdt3304_state));
state->addr = config->i2c_address;
state->i2c = i2c;
diff --git a/linux/drivers/media/dvb/frontends/s921_module.c b/linux/drivers/media/dvb/frontends/s921_module.c
index 8ae0676a5..4a673c184 100644
--- a/linux/drivers/media/dvb/frontends/s921_module.c
+++ b/linux/drivers/media/dvb/frontends/s921_module.c
@@ -233,7 +233,6 @@ struct dvb_frontend* s921_attach(const struct s921_config *config,
struct s921_state *state;
state = kzalloc(sizeof(struct s921_state), GFP_KERNEL);
- memset(state, 0x0, sizeof(struct s921_state));
state->addr = config->i2c_address;
state->i2c = i2c;