V4L/DVB (10662): remove redundant memset after kzalloc
authorMatthias Schwarzott <zzam@gentoo.org>
Mon, 23 Feb 2009 15:26:38 +0000 (12:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:52 +0000 (12:42 -0300)
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>
drivers/media/dvb/frontends/cx24113.c
drivers/media/dvb/frontends/cx24116.c
drivers/media/dvb/frontends/cx24123.c
drivers/media/dvb/frontends/lgdt3304.c
drivers/media/dvb/frontends/s921_module.c

index f6e7b0380a5a5c5676db3089145cadc25c6d9b22..e4fd533a427c43dd86c75b6acc667d10692204d4 100644 (file)
@@ -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;
        }
 
index ba1e24c82272d0f2014acb03785af250c397440a..9b9f57264ceff0bd76c7685477ae22486d2a4b5a 100644 (file)
@@ -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;
 
index 1a8c36f76061a83d6df460eec40eae4342bce299..0592f043ea64481228ffc9c26ae0c60929308ec3 100644 (file)
@@ -1069,13 +1069,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;
        }
 
index 3bb0c4394f8a17ac8ace04405326e8dc1d4c710c..eb72a9866c93769bb4d94715328d32d816f591d6 100644 (file)
@@ -363,7 +363,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;
 
index 892af8c9ed570d3038b0f9f4b040aea3040d629f..3f5a0e1dfdf5dd50918966f6474d4e8b25e01b89 100644 (file)
@@ -169,7 +169,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;