diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-29 16:38:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:01:35 -0500 |
commit | 1808a698a87366f9d82945270355c2139df0a16d (patch) | |
tree | f9842853056a271fac66852a1127e930a25f114d /drivers/media/video/tuner-xc2028.c | |
parent | 882876bf9780fac570184b719a76140a1b1e4178 (diff) |
V4L/DVB (6475): Fix some troubles at list handling
- priv->count were wrong. Should be incremented since the first usage;
- forgot to use list_del() to remove the driver;
- Release memory if an error occurs during _attach
Thanks to Aidan Thornton <makosoft@googlemail.com> for pointing this.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-xc2028.c')
-rw-r--r-- | drivers/media/video/tuner-xc2028.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c index 7d53d58aafa1..c5bdeff54288 100644 --- a/drivers/media/video/tuner-xc2028.c +++ b/drivers/media/video/tuner-xc2028.c | |||
@@ -639,6 +639,8 @@ static int xc2028_dvb_release(struct dvb_frontend *fe) | |||
639 | priv->count--; | 639 | priv->count--; |
640 | 640 | ||
641 | if (!priv->count) { | 641 | if (!priv->count) { |
642 | list_del(&priv->xc2028_list); | ||
643 | |||
642 | if (priv->ctrl.fname) | 644 | if (priv->ctrl.fname) |
643 | kfree(priv->ctrl.fname); | 645 | kfree(priv->ctrl.fname); |
644 | 646 | ||
@@ -728,7 +730,6 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap, | |||
728 | list_for_each_entry(priv, &xc2028_list, xc2028_list) { | 730 | list_for_each_entry(priv, &xc2028_list, xc2028_list) { |
729 | if (priv->dev == dev) { | 731 | if (priv->dev == dev) { |
730 | dev = NULL; | 732 | dev = NULL; |
731 | priv->count++; | ||
732 | } | 733 | } |
733 | } | 734 | } |
734 | 735 | ||
@@ -754,6 +755,7 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap, | |||
754 | 755 | ||
755 | list_add_tail(&priv->xc2028_list,&xc2028_list); | 756 | list_add_tail(&priv->xc2028_list,&xc2028_list); |
756 | } | 757 | } |
758 | priv->count++; | ||
757 | 759 | ||
758 | memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops, | 760 | memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops, |
759 | sizeof(xc2028_dvb_tuner_ops)); | 761 | sizeof(xc2028_dvb_tuner_ops)); |