ANDROID: goldfish: goldfish_pipe: fix locking errors
authorGreg Hackmann <ghackmann@google.com>
Fri, 18 Nov 2016 19:09:02 +0000 (11:09 -0800)
committerAmit Pundir <amit.pundir@linaro.org>
Thu, 1 Dec 2016 09:48:44 +0000 (15:18 +0530)
commit5bfd5dee568e3af818114a7ef83f8a38a42a6064
tree45796f56ae0a090de34ff9138f95e544d239455d
parent02bb8ad0e42c8e01ec0a61aaa3a4ede68a1447e6
ANDROID: goldfish: goldfish_pipe: fix locking errors

If the get_user_pages_fast() call in goldfish_pipe_read_write() failed,
it would return while still holding pipe->lock.

goldfish_pipe_read_write() later releases and tries to re-acquire
pipe->lock.  If the re-acquire call failed, goldfish_pipe_read_write()
would try unlock pipe->lock on exit anyway.

This fixes the smatch messages:

drivers/platform/goldfish/goldfish_pipe.c:392 goldfish_pipe_read_write() error: double unlock 'mutex:&pipe->lock'
drivers/platform/goldfish/goldfish_pipe.c:397 goldfish_pipe_read_write() warn: inconsistent returns 'mutex:&pipe->lock'.

Change-Id: Ifd06a76b32027ca451a001704ade0c5440ed69c4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
drivers/platform/goldfish/goldfish_pipe.c