diff mbox

[2/2,media] em28xx: Fix IR unregister logic

Message ID 20110729025355.2fe04c6b@redhat.com (mailing list archive)
State Accepted
Headers show

Commit Message

Mauro Carvalho Chehab July 29, 2011, 5:53 a.m. UTC
The input stop() callback already calls the em28xx_ir_stop method.
Calling it again causes an oops.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Comments

Jarod Wilson July 29, 2011, 9:40 p.m. UTC | #1
On Jul 29, 2011, at 1:53 AM, Mauro Carvalho Chehab wrote:

> The input stop() callback already calls the em28xx_ir_stop method.
> Calling it again causes an oops.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Yep, my old em28xx HVR-950 behaves much better with this and patch 1
of the pair applied.

Acked-by: Jarod Wilson <jarod@redhat.com>
diff mbox

Patch

diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index 5d12b14..679da48 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -463,11 +463,11 @@  int em28xx_ir_fini(struct em28xx *dev)
 	if (!ir)
 		return 0;
 
-	em28xx_ir_stop(ir->rc);
-	rc_unregister_device(ir->rc);
-	kfree(ir);
+	if (ir->rc)
+		rc_unregister_device(ir->rc);
 
 	/* done */
+	kfree(ir);
 	dev->ir = NULL;
 	return 0;
 }