staging: ft1000: flatten nesting in handle_misc_portid
authorKelley Nielsen <kelleynnn@gmail.com>
Wed, 6 Nov 2013 13:08:58 +0000 (05:08 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2013 15:55:00 +0000 (07:55 -0800)
commitf3802bdb15f7bea68ca330d8d909c56ac1e15119
tree0d7816e9226ee529c69aa6657912a5643e48cc7a
parent8a58cad260bd37b7d20d222b083b4844d086b2d7
staging: ft1000: flatten nesting in handle_misc_portid

The newly extracted function handle_misc_portid still has several
unnecessary levels of nesting, having inherited its logic from the
original extracted lines. Move handling for failed memory allocation
(of *pdpram_blk) to the top of the function, and return -1 from within
it. This eliminates the if statement around the body of the function.
Change two levels of nested if/else to an if/else-if/else. Create a
label, exit_failure, at the end of the function with the cleanup code,
and goto it at all points of failure. Also, goto it if the call to
ft1000_receive_cmd() fails, instead of descending into an if block if
it succeeds. Pull all lines from inside the former if blocks to the
left, and rejoin lines to take advantage of reclaimed horizontal space.

Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c