summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-core
diff options
context:
space:
mode:
authorDaniel Scheller <d.scheller@gmx.net>2017-10-29 11:43:22 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-11-07 05:39:41 -0500
commit62229de19ff2b7f3e0ebf4d48ad99061127d0281 (patch)
treea6276aefcf74df68bf2787825cbeaf3954a27b5e /drivers/media/dvb-core
parentb4b138a9d31924cb9ab535138deb150d6ec418a5 (diff)
downloadblackbird-op-linux-62229de19ff2b7f3e0ebf4d48ad99061127d0281.tar.gz
blackbird-op-linux-62229de19ff2b7f3e0ebf4d48ad99061127d0281.zip
media: dvb-core: always call invoke_release() in fe_free()
Follow-up to: ead666000a5f ("media: dvb_frontend: only use kref after initialized") The aforementioned commit fixed refcount OOPSes when demod driver attaching succeeded but tuner driver didn't. However, the use count of the attached demod drivers don't go back to zero and thus couldn't be cleanly unloaded. Improve on this by calling dvb_frontend_invoke_release() in __dvb_frontend_free() regardless of fepriv being NULL, instead of returning when fepriv is NULL. This is safe to do since _invoke_release() will check for passed pointers being valid before calling the .release() function. [mchehab@s-opensource.com: changed the logic a little bit to reduce conflicts with another bug fix patch under review] Fixes: ead666000a5f ("media: dvb_frontend: only use kref after initialized") Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-core')
-rw-r--r--drivers/media/dvb-core/dvb_frontend.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index daaf969719e4..d485d5f6cc88 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -145,13 +145,14 @@ static void __dvb_frontend_free(struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
- if (!fepriv)
- return;
-
- dvb_free_device(fepriv->dvbdev);
+ if (fepriv)
+ dvb_free_device(fepriv->dvbdev);
dvb_frontend_invoke_release(fe, fe->ops.release);
+ if (!fepriv)
+ return;
+
kfree(fepriv);
fe->frontend_priv = NULL;
}
OpenPOWER on IntegriCloud