Re: [Patch 1/3] Staging: rtl8723bs: Placing opening { braces in previous line

From: Joe Perches
Date: Tue Jan 25 2022 - 12:26:03 EST


On Mon, 2022-01-24 at 09:14 +0530, Jagath Jog J wrote:
> Fix following checkpatch.pl error by placing opening {
> braces in previous line
> ERROR: that open brace { should be on the previous line
[]
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
[]
> @@ -113,13 +113,10 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
> struct ieee80211_supported_band *spt_band = NULL;
> int n_channels, n_bitrates;
>
> - if (band == NL80211_BAND_2GHZ)
> - {
> + if (band == NL80211_BAND_2GHZ) {
> n_channels = RTW_2G_CHANNELS_NUM;
> n_bitrates = RTW_G_RATES_NUM;
> - }
> - else
> - {
> + } else {
> goto exit;
> }

Reversing the test would be less indented and simpler code:

if (band != NL80211_BAND_2GHZ)
goto exit;

n_channels = RTW_2G_CHANNELS_NUM;
n_bitrates = RTW_G_RATES_NUM;

etc...