diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-05 11:21:07 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-11 06:56:46 -0300 |
commit | 47677e51e2a4040c204d7971a5103592600185b1 (patch) | |
tree | 58196e42f5ad37ee12333a69593d444f0d1e10de /drivers/media/usb/em28xx/em28xx-input.c | |
parent | 88e4fcda55e07278fcf5f6eea684685ffc0633e2 (diff) | |
download | linux-47677e51e2a4040c204d7971a5103592600185b1.tar.bz2 |
[media] em28xx: Only deallocate struct em28xx after finishing all extensions
We can't free struct em28xx while one of the extensions is still
using it.
So, add a kref() to control it, freeing it only after the
extensions fini calls.
Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-input.c')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-input.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 47a2c1dcccbf..2a9bf667f208 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -676,6 +676,8 @@ static int em28xx_ir_init(struct em28xx *dev) return 0; } + kref_get(&dev->ref); + if (dev->board.buttons) em28xx_init_buttons(dev); @@ -816,7 +818,7 @@ static int em28xx_ir_fini(struct em28xx *dev) /* skip detach on non attached boards */ if (!ir) - return 0; + goto ref_put; if (ir->rc) rc_unregister_device(ir->rc); @@ -824,6 +826,10 @@ static int em28xx_ir_fini(struct em28xx *dev) /* done */ kfree(ir); dev->ir = NULL; + +ref_put: + kref_put(&dev->ref, em28xx_free_device); + return 0; } |