Always call tda829x_release if tda829x_attach fails for a reason
other than failure to allocate memory for private structure.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
        }
 
        if (tda829x_find_tuner(fe) < 0)
-               return -EINVAL;
+               goto fail;
 
        if (priv->ver & TDA8290) {
                tda8290_init_tuner(fe);
        t->mode = V4L2_TUNER_ANALOG_TV;
 
        return 0;
+
+fail:
+       tda829x_release(fe);
+       fe->ops.analog_demod_ops = NULL;
+       return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(tda829x_attach);