- 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>
        priv->count--;
 
        if (!priv->count) {
+               list_del(&priv->xc2028_list);
+
                if (priv->ctrl.fname)
                        kfree(priv->ctrl.fname);
 
        list_for_each_entry(priv, &xc2028_list, xc2028_list) {
                if (priv->dev == dev) {
                        dev = NULL;
-                       priv->count++;
                }
        }
 
 
                list_add_tail(&priv->xc2028_list,&xc2028_list);
        }
+       priv->count++;
 
        memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops,
                                               sizeof(xc2028_dvb_tuner_ops));