staging: r8188eu: refactor rtw_ch2freq()
authorMichael Straube <straube.linux@gmail.com>
Tue, 22 Feb 2022 08:28:46 +0000 (09:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Feb 2022 09:06:49 +0000 (10:06 +0100)
commitb052de6526383a7199079ae68afd92f9187c0862
treef41dc33096d75b67ffa1010a755be79f13994eec
parent6f29d72d2b7ae4caba2d9e578424ed32ba66ec3e
staging: r8188eu: refactor rtw_ch2freq()

Convert the array ch_freq_map to a simple integer array and use
the indices as channel numbers. This simplifies the code and avoids
looping through the array to get the frequency. To avoid out of
bounds array access return a default value for invalid channel values,
like the original code did.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220222082847.6687-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_rf.c