Error handling code following a kmalloc or kzalloc should free the
allocated data.
The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
when != if (...) { <+...x...+> }
(
x->f1 = E
|
(x->f1 == NULL || ...)
|
f(...,x->f1,...)
)
...>
(
return \(0\|<+...x...+>\|ptr\);
|
return@p2 ...;
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
This was done using a semantic patch (http://coccinelle.lip6.fr/) that
checks that the declaration is not inside a function definition, that the
defined variable is not exported using EXPORTED_SYMBOL, etc, and that the
defined variable does not occur in any other file. If these conditions
hold, static is added before the declaration.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Check that SMBUS APIs are available in touchscreen driver.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Support for input devices connected to GPIO pins. This adds support
for HTC Dream's keyboard and its trackball. Generic support already
exists for keyboard on GPIO, but this one is more advanced because it
can detect shadow key presses (and actually works with Dream :-).
(It also contains Kconfig/Makefile changes, including some that were
missing from previous commit. Sorry.)
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
In vfe_send_msg_no_payload there is a wrong struct vfe_message allocation.
It allocates only sizeof(pointer to vfe_message) for a whole structure.
Add a dereference to the sizeof to allocate sizeof(vfe_message).
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This adds pointer to hardware documentation, and adds code comment
from Arve.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This separates coefficient computation into separate function, so that
main probe does not have 1001 variables, and is of a more reasonable
size.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This is first part of touchscreen cleanups. I did not remove
earlysuspend functionality for now (to help Google merge the changes).
I mainly introduced helpers to reduce code duplication, and split huge
functions into smaller ones.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This adds support for synaptic touchscreen, used in HTC dream
cellphone.
This is original version from Arve, fixed only to compile; I do have
cleaner version, but I broken something inside, and this will preserve
authorship better. I originally tried to push the driver directly to
input/touchscreen, but the driver has some issues with interrupt
handling that are more difficult to fix than I expected at first.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Limit SMD communication glue to MSM platform. It is closely tied to
MSM architecture.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch adds driver for HTC Dream camera. I guess driver is
slightly higher quality than usual for staging/ , but it is fairly big
and I don't feel like doing all the cleanups myself. Also some parts
can probably be removed, as they did not end up in shipping hardware..
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <ibm@android.com>
Cc: San Mehat <san@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
QDSP code is neccessarry for communication with some hardware
components on HTC Dream, including camera hardware. It also drives DSP
coproccessor.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <ibm@android.com>
Cc: San Mehat <san@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
rpcrouter code is neccessarry for communication with QDSP and thus
many hardware components on HTC Dream, including camera hardware.
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <ibm@android.com>
Cc: San Mehat <san@android.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Infrastructure to support the Qualcomm "shared memory driver"
interface, used to communicate with the baseband processor on MSM7k
SoCs. The smd core provides low level facilities to interact with the
shared memory comms region, and a "virtual serial channel" interface
that higher level transports (AT command channel, rmnet virtual
ethernet, qmi network management protocol, and oncrpc, for example)
are routed over.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <ibm@android.com>
Cc: San Mehat <san@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>