]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/tvaudio.c
V4L/DVB (9613): tvaudio: fix a memory leak
[linux-2.6-omap-h63xx.git] / drivers / media / video / tvaudio.c
index 463680b13289c6515d658225b8711f6e39c26caf..3332df890f0b9cd8b300cc96482d5e176c1cadc4 100644 (file)
@@ -1481,6 +1481,7 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id)
        }
        if (desc->name == NULL) {
                v4l_dbg(1, debug, client, "no matching chip description found\n");
+               kfree(chip);
                return -EIO;
        }
        v4l_info(client, "%s found @ 0x%x (%s)\n", desc->name, client->addr<<1, client->adapter->name);
@@ -1792,7 +1793,7 @@ static int chip_command(struct i2c_client *client,
                break;
        case VIDIOC_S_FREQUENCY:
                chip->mode = 0; /* automatic */
-               if (desc->checkmode) {
+               if (desc->checkmode && desc->setmode) {
                        desc->setmode(chip,V4L2_TUNER_MODE_MONO);
                        if (chip->prevmode != V4L2_TUNER_MODE_MONO)
                                chip->prevmode = -1; /* reset previous mode */