aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Senna Tschudin <peter.senna@gmail.com>2012-09-12 07:56:03 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-06 10:11:42 -0400
commit1a5d2da1134c4d7371db71377815aa3fff9f75cd (patch)
tree35d842ad8fd4b1dc0747f1e89579d710968fe988 /drivers
parent3f037426d61027d40063a1fc2d00a08154c7c187 (diff)
[media] drivers/media/dvb-frontends/lg2160.c: Removes useless kfree()
Remove useless kfree() and clean up code related to the removal. The semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r exists@ position p1,p2; expression x; @@ if (x@p1 == NULL) { ... kfree@p2(x); ... return ...; } @unchanged exists@ position r.p1,r.p2; expression e <= r.x,x,e1; iterator I; statement S; @@ if (x@p1 == NULL) { ... when != I(x,...) S when != e = e1 when != e += e1 when != e -= e1 when != ++e when != --e when != e++ when != e-- when != &e kfree@p2(x); ... return ...; } @ok depends on unchanged exists@ position any r.p1; position r.p2; expression x; @@ ... when != true x@p1 == NULL kfree@p2(x); @depends on !ok && unchanged@ position r.p2; expression x; @@ *kfree@p2(x); // </smpl> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb-frontends/lg2160.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/media/dvb-frontends/lg2160.c b/drivers/media/dvb-frontends/lg2160.c
index cc11260e99df..5fd14f840ab0 100644
--- a/drivers/media/dvb-frontends/lg2160.c
+++ b/drivers/media/dvb-frontends/lg2160.c
@@ -1421,8 +1421,8 @@ struct dvb_frontend *lg2160_attach(const struct lg2160_config *config,
1421 config ? config->i2c_addr : 0); 1421 config ? config->i2c_addr : 0);
1422 1422
1423 state = kzalloc(sizeof(struct lg216x_state), GFP_KERNEL); 1423 state = kzalloc(sizeof(struct lg216x_state), GFP_KERNEL);
1424 if (state == NULL) 1424 if (!state)
1425 goto fail; 1425 return NULL;
1426 1426
1427 state->cfg = config; 1427 state->cfg = config;
1428 state->i2c_adap = i2c_adap; 1428 state->i2c_adap = i2c_adap;
@@ -1449,10 +1449,6 @@ struct dvb_frontend *lg2160_attach(const struct lg2160_config *config,
1449 state->frontend.dtv_property_cache.atscmh_parade_id = 1; 1449 state->frontend.dtv_property_cache.atscmh_parade_id = 1;
1450 1450
1451 return &state->frontend; 1451 return &state->frontend;
1452fail:
1453 lg_warn("unable to detect LG216x hardware\n");
1454 kfree(state);
1455 return NULL;
1456} 1452}
1457EXPORT_SYMBOL(lg2160_attach); 1453EXPORT_SYMBOL(lg2160_attach);
1458 1454