aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/tuner-core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 0e71a22f1d4..acbffbfdb50 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -180,8 +180,10 @@ static void set_type(struct i2c_client *c, unsigned int type,
/* discard private data, in case set_type() was previously called */
if (t->release)
t->release(c);
- kfree(t->priv);
- t->priv = NULL;
+ else {
+ kfree(t->priv);
+ t->priv = NULL;
+ }
switch (t->type) {
case TUNER_MT2032:
@@ -566,7 +568,9 @@ static int tuner_detach(struct i2c_client *client)
if (t->release)
t->release(client);
- kfree(t->priv);
+ else {
+ kfree(t->priv);
+ }
kfree(t);
return 0;
}