staging: rtl8723bs: simplify control flow
authorSevinj Aghayeva <sevinj.aghayeva@gmail.com>
Fri, 1 Apr 2022 11:46:35 +0000 (07:46 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Apr 2022 05:33:49 +0000 (07:33 +0200)
commit875e957087b5f8624a1fbfe9d9b9647ec7912bd4
treeb18c638a692706797d55412783eaf5b614b62dbf
parent47f46a873d9bd29f1d663517eff4a4ad7c1654b9
staging: rtl8723bs: 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

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
Link: https://lore.kernel.org/r/20220401114635.GA567659@euclid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme.c