diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2009-02-23 10:26:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:52 -0400 |
commit | 8420fa7ee22c1d681549ff7ab0466ceda5a911c2 (patch) | |
tree | 62e85db6e66870efa58df24dd69a9c2f8784e5d1 /drivers | |
parent | 51ca3bddf34bb6cdbdddd89f59fe3a0131d40eba (diff) |
V4L/DVB (10662): remove redundant memset after kzalloc
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 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/cx24113.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/cx24116.c | 5 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/cx24123.c | 4 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/lgdt3304.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/s921_module.c | 1 |
5 files changed, 4 insertions, 9 deletions
diff --git a/drivers/media/dvb/frontends/cx24113.c b/drivers/media/dvb/frontends/cx24113.c index f6e7b0380a5a..e4fd533a427c 100644 --- a/drivers/media/dvb/frontends/cx24113.c +++ b/drivers/media/dvb/frontends/cx24113.c | |||
@@ -559,7 +559,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe, | |||
559 | kzalloc(sizeof(struct cx24113_state), GFP_KERNEL); | 559 | kzalloc(sizeof(struct cx24113_state), GFP_KERNEL); |
560 | int rc; | 560 | int rc; |
561 | if (state == NULL) { | 561 | if (state == NULL) { |
562 | err("Unable to kmalloc\n"); | 562 | err("Unable to kzalloc\n"); |
563 | goto error; | 563 | goto error; |
564 | } | 564 | } |
565 | 565 | ||
diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index ba1e24c82272..9b9f57264cef 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c | |||
@@ -1112,13 +1112,10 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, | |||
1112 | dprintk("%s\n", __func__); | 1112 | dprintk("%s\n", __func__); |
1113 | 1113 | ||
1114 | /* allocate memory for the internal state */ | 1114 | /* allocate memory for the internal state */ |
1115 | state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL); | 1115 | state = kzalloc(sizeof(struct cx24116_state), GFP_KERNEL); |
1116 | if (state == NULL) | 1116 | if (state == NULL) |
1117 | goto error1; | 1117 | goto error1; |
1118 | 1118 | ||
1119 | /* setup the state */ | ||
1120 | memset(state, 0, sizeof(struct cx24116_state)); | ||
1121 | |||
1122 | state->config = config; | 1119 | state->config = config; |
1123 | state->i2c = i2c; | 1120 | state->i2c = i2c; |
1124 | 1121 | ||
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c index 1a8c36f76061..0592f043ea64 100644 --- a/drivers/media/dvb/frontends/cx24123.c +++ b/drivers/media/dvb/frontends/cx24123.c | |||
@@ -1069,13 +1069,13 @@ static struct dvb_frontend_ops cx24123_ops; | |||
1069 | struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, | 1069 | struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, |
1070 | struct i2c_adapter *i2c) | 1070 | struct i2c_adapter *i2c) |
1071 | { | 1071 | { |
1072 | /* allocate memory for the internal state */ | ||
1072 | struct cx24123_state *state = | 1073 | struct cx24123_state *state = |
1073 | kzalloc(sizeof(struct cx24123_state), GFP_KERNEL); | 1074 | kzalloc(sizeof(struct cx24123_state), GFP_KERNEL); |
1074 | 1075 | ||
1075 | dprintk("\n"); | 1076 | dprintk("\n"); |
1076 | /* allocate memory for the internal state */ | ||
1077 | if (state == NULL) { | 1077 | if (state == NULL) { |
1078 | err("Unable to kmalloc\n"); | 1078 | err("Unable to kzalloc\n"); |
1079 | goto error; | 1079 | goto error; |
1080 | } | 1080 | } |
1081 | 1081 | ||
diff --git a/drivers/media/dvb/frontends/lgdt3304.c b/drivers/media/dvb/frontends/lgdt3304.c index 3bb0c4394f8a..eb72a9866c93 100644 --- a/drivers/media/dvb/frontends/lgdt3304.c +++ b/drivers/media/dvb/frontends/lgdt3304.c | |||
@@ -363,7 +363,6 @@ struct dvb_frontend* lgdt3304_attach(const struct lgdt3304_config *config, | |||
363 | 363 | ||
364 | struct lgdt3304_state *state; | 364 | struct lgdt3304_state *state; |
365 | state = kzalloc(sizeof(struct lgdt3304_state), GFP_KERNEL); | 365 | state = kzalloc(sizeof(struct lgdt3304_state), GFP_KERNEL); |
366 | memset(state, 0x0, sizeof(struct lgdt3304_state)); | ||
367 | state->addr = config->i2c_address; | 366 | state->addr = config->i2c_address; |
368 | state->i2c = i2c; | 367 | state->i2c = i2c; |
369 | 368 | ||
diff --git a/drivers/media/dvb/frontends/s921_module.c b/drivers/media/dvb/frontends/s921_module.c index 892af8c9ed57..3f5a0e1dfdf5 100644 --- a/drivers/media/dvb/frontends/s921_module.c +++ b/drivers/media/dvb/frontends/s921_module.c | |||
@@ -169,7 +169,6 @@ struct dvb_frontend* s921_attach(const struct s921_config *config, | |||
169 | 169 | ||
170 | struct s921_state *state; | 170 | struct s921_state *state; |
171 | state = kzalloc(sizeof(struct s921_state), GFP_KERNEL); | 171 | state = kzalloc(sizeof(struct s921_state), GFP_KERNEL); |
172 | memset(state, 0x0, sizeof(struct s921_state)); | ||
173 | 172 | ||
174 | state->addr = config->i2c_address; | 173 | state->addr = config->i2c_address; |
175 | state->i2c = i2c; | 174 | state->i2c = i2c; |