Commit graph

5 commits

Author SHA1 Message Date
Julia Lawall
311fda8e8b drivers/staging/cptm1217/clearpad_tm1217.c: Correct call to input_free_device
This code is in a loop that currently is only executed once.  Because of
this property, the first block of code is currently actually correct.
Nevertheless, the comments associated with the code suggest that the loop
is planned to take more than one iteration in the future, and thus this
patch is made with that case in mind.

In the first block of code, there is currently an immediate abort from the
function.  It is changed to jump to the error handling code at fail, to be
able to unregister and free the resources allocated on previous iterations.

In the second block of code, the input_dev for the current iteration has
been allocated, but has not been registered.  It has also not been stored
in ts->cp_input_info[i].input.  Thus on jumping to fail, it will not be
freed.  In this case, we want to free, but not unregister, so the free for
this most recently allocated resource is put before the jump.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
local idexpression struct input_dev * x;
expression ra,rr;
position p1,p2;
@@

x = input_allocate_device@p1(...)
...  when != x = rr
     when != input_free_device(x,...)
     when != if (...) { ... input_free_device(x,...) ...}
if(...) { ... when != x = ra
     when forall
     when != input_free_device(x,...)
 \(return <+...x...+>; \| return@p2...; \) }

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

cocci.print_main("input_allocate_device",p1)
cocci.print_secs("input_free_device",p2)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-18 14:30:49 -07:00
Lucas De Marchi
25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Randy Dunlap
d948d5f96a staging: clearpad_tm1217 depends on INPUT
clearpad_tm1217 driver uses many input_() interfaces, so it should
depend on INPUT.

clearpad_tm1217.c:(.text+0xf19ac): undefined reference to `input_unregister_device'
clearpad_tm1217.c:(.text+0xf1b19): undefined reference to `input_event'
clearpad_tm1217.c:(.text+0xf1b31): undefined reference to `input_event'
clearpad_tm1217.c:(.text+0xf1bb4): undefined reference to `input_event'
clearpad_tm1217.c:(.text+0xf1bf2): undefined reference to `input_event'
drivers/built-in.o:clearpad_tm1217.c:(.text+0xf1c08): more undefined references to `input_event' follow
clearpad_tm1217.c:(.text+0xf1df3): undefined reference to `input_allocate_device'
clearpad_tm1217.c:(.text+0xf1eac): undefined reference to `input_set_abs_params'
clearpad_tm1217.c:(.text+0xf1ed1): undefined reference to `input_set_abs_params'
clearpad_tm1217.c:(.text+0xf1ed8): undefined reference to `input_register_device'
clearpad_tm1217.c:(.text+0xf2040): undefined reference to `input_unregister_device'
clearpad_tm1217.c:(.text+0xf204b): undefined reference to `input_free_device'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Ramesh Agarwal <ramesh.agarwal@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-19 17:17:45 -08:00
Dan Carpenter
a1a26e492c Staging: cptm1217: move free under dereference
We dereference "ts" in the printk so move the kfree() down a line.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-16 12:31:49 -08:00
Ramesh Agarwal
78fd115e21 Staging: add Synaptics TM1217 Touchscreen Controller driver
This is submitted as a staging driver because there is a more generic driver
"on the way" for all these devices and has been for some time. The intent is
that as soon as the general drivers are in the mainstream this one will get
any leftovers integrated and then be dumped. Until this unspecified future
data at least people can actually use their hardware.

As its interface is simply input layer we can do that without pain.

Some clean up by Alan Cox
  - Extract gpio support and IRQ support more sanely
  - Tidying

Signed-off-by: Ramesh Agarwal <ramesh.agarwal@intel.com>
[avoid deference NULL ts if kzalloc fails]
[finger_touched may be used uninitialized]
[fix missing sync which confused twm]
Signed-off-by: Hong Liu <hong.liu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 15:19:50 -08:00