]> git.baikalelectronics.ru Git - kernel.git/commit
staging: rtl8712: simplify control flow
authorSevinj Aghayeva <sevinj.aghayeva@gmail.com>
Sun, 3 Apr 2022 16:53:25 +0000 (12:53 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Apr 2022 14:03:11 +0000 (16:03 +0200)
commit1d0fc9a27a74c84d69427f3cf8db25e7f8fe4eba
tree0115bf99048902de703804886aadc72ec6f8aab2
parent1e1defa590baccc3e8e0fd0a8e46e5d30db9659e
staging: rtl8712: simplify control flow

The function iterates an index from 0 to NUM_PMKID_CACHE and returns
the first index for which the condition is true. If no such index is
found, the function returns -1. Current code has a complex control
flow that obfuscates this simple task. Replace it with a loop.

Also, given the shortened function body, replace the long variable
name psecuritypriv with a short variable name p.

Reported by checkpatch:

WARNING: else is not generally useful after a break or return

Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
Link: https://lore.kernel.org/r/20220403165325.GA374638@euclid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/rtl871x_mlme.c