OSDN Git Service

staging: ks7010: move skb null check near allocation
authorTobin C. Harding <me@tobin.cc>
Thu, 27 Apr 2017 01:25:14 +0000 (11:25 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Apr 2017 09:45:49 +0000 (11:45 +0200)
commit8cd1dbe1db97ad74c5265e09c3490eeb7986f623
treeedee85a9f4ce568501fc800698f28e493038fdda
parent69f3fecc49cabaadf4839dda4227427fc15b4c7e
staging: ks7010: move skb null check near allocation

Currently, after allocating an sk_buff, driver fills the sk_buff
within code block guarded by a NULL check on the sk_buff. If a NULL
check is done immediately after the allocation, and code returns on
error, then the subsequent code need not be guarded and the level of
indentation may be reduced. This aids the readability of the code and
makes explicit the error path.

Check for NULL directly after allocating the sk_buff, return if
allocation fails. Reduce indentation of subsequent code. Do not change
the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ks7010/ks_hostif.c