Commit graph

10 commits

Author SHA1 Message Date
Jesper Juhl
c659395935 [media] tm6000: Don't use pointer after freeing it in tm6000_ir_fini()
In tm6000_ir_fini() there seems to be a problem.
rc_unregister_device(ir->rc); calls rc_free_device() on the pointer it is
given, which frees it.

Subsequently the function does:

  if (!ir->polling)
    __tm6000_ir_int_stop(ir->rc);

and __tm6000_ir_int_stop() dereferences the pointer it is given, which
has already been freed.

and it also does:

  tm6000_ir_stop(ir->rc);

which also dereferences the (already freed) pointer.

So, it seems that the call to rc_unregister_device() should be move
below the calls to __tm6000_ir_int_stop() and tm6000_ir_stop(), so
those don't operate on a already freed pointer.

But, I must admit that I don't know this code *at all*, so someone who
knows the code should take a careful look before applying this
patch. It is based purely on inspection of facts of what is beeing
freed where and not at all on understanding what the code does or why.
I don't even have a means to test it, so beyond testing that the
change compiles it has seen no testing what-so-ever.

Anyway, here's a proposed patch.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-02-08 10:59:56 -02:00
Dan Carpenter
b16ec6f735 [media] tm6000: using an uninitialized variable in debug code
dprintk() dereferences "ir".  I'm not sure why gcc doesn't complain
about this.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-30 17:32:48 -02:00
Mauro Carvalho Chehab
56a8b9f181 [media] tm6000: Fix a warning at tm6000_ir_int_start()
drivers/media/video/tm6000/tm6000-input.c: In function ‘tm6000_ir_int_start’:
drivers/media/video/tm6000/tm6000-input.c:381:3: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11 12:20:49 -02:00
Thierry Reding
4be9c8fb58 [media] tm6000: Fix check for interrupt endpoint
Checking for &dev->int_in is useless because it returns the address of
the embedded struct tm6000_endpoint, which will always be positive and
therefore true.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11 10:47:37 -02:00
Mauro Carvalho Chehab
2a887d2770 [media] tm6000: fix OOPS at tm6000_ir_int_stop() and tm6000_ir_int_start()
[ 3755.608233] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[ 3755.616360] IP: [<ffffffffa03b80b7>] tm6000_ir_int_stop+0x10/0x1b [tm6000]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-30 16:49:45 -02:00
Mauro Carvalho Chehab
9f711a80c5 [media] tm6000: Use a 16 scancode bitmask for IR
This should allow using 24 or 32 bits NEC IR decoding tables with
those devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-30 14:58:20 -02:00
Mauro Carvalho Chehab
4a83b01150 [media] tm6000: rewrite IR support
The IR support were broken on my tests with HVR-900H. Also,
there were several issues on the current implementation.
This patch is a major rewrite of the IR support for this
	- Improve debug messages;
	- Don't do polling for interrrupt based IR;
	- Add proper support for RC-5 protocol;
	- Always provide 16 bits for NEC and RC-5;
	- Fix polling code;
	- Split polling functions from URB Interrupt ones;
	- Don't hardcode the XTAL reference for tm6000 IR;
	- If a URB submit fails, retries after 100ms;
	- etc.

Tested on Hauppauge HVR-900H, with RC-5 and NEC remotes.

Issues on IR handling, on this device:
	- Repeat events aren't detected (neither on NEC or RC-5);
	- NEC codes are always provided with 16 bits.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-30 14:54:11 -02:00
Mauro Carvalho Chehab
15a295ec31 [media] tm6000: Fix IR register names
IR registers 0xd9 to 0xdf were badly named, making harder to
check what's the register accessed at the RC code. Fix the
name convention.

No functional changes on this patch.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-30 14:43:06 -02:00
Stefan Ringel
edcfdd919a [media] tm6000: bugfix data check
beholder use a map with 3 bytes, but many rc maps have 2 bytes, so I add a workaround for beholder rc.

Signed-off-by: Stefan Ringel <linuxtv@stefanringel.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-28 21:31:09 -02:00
Mauro Carvalho Chehab
be30497085 [media] move tm6000 to drivers/media/video
The serious bugs got fixed already.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-23 09:32:35 -03:00
Renamed from drivers/staging/tm6000/tm6000-input.c (Browse further)