Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rtl8712: Invert the test on check_fwstate() to reduce indentation

Negate if condition to be able to return immediately in case of error,
and then continue with the rest of the function
without extra indentation level.

This was found using the following Coccinelle script:

@disable neg_if@
expression e,E;
statement S;
@@

*if (e)
S
else { return -E; }

@disable neg_if@
expression e,E;
statement S;
identifier
l;
@@

*if
(e)
S
else
{ rc = -E; goto l; }

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Narcisa Ana Maria Vasile and committed by
Greg Kroah-Hartman
09e1aa1a e6d93795

+7 -7
+7 -7
drivers/staging/rtl8712/rtl871x_ioctl_linux.c
··· 695 695 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 696 696 struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; 697 697 698 - if (check_fwstate(pmlmepriv, _FW_LINKED)) { 699 - wrqu->freq.m = ieee80211_wlan_frequencies[ 700 - pcur_bss->Configuration.DSConfig - 1] * 100000; 701 - wrqu->freq.e = 1; 702 - wrqu->freq.i = pcur_bss->Configuration.DSConfig; 703 - } else { 698 + if (!check_fwstate(pmlmepriv, _FW_LINKED)) 704 699 return -ENOLINK; 705 - } 700 + 701 + wrqu->freq.m = ieee80211_wlan_frequencies[ 702 + pcur_bss->Configuration.DSConfig - 1] * 100000; 703 + wrqu->freq.e = 1; 704 + wrqu->freq.i = pcur_bss->Configuration.DSConfig; 705 + 706 706 return 0; 707 707 } 708 708