Re: [PATCH] staging: rtl8723bs: fix placement of braces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2022-05-22 at 18:06 +0200, Hannes Braun wrote:
> This patch should eliminate the following errors/warnings emitted by
> checkpatch.pl:
> - that open brace { should be on the previous line
> - else should follow close brace '}'
> - braces {} are not necessary for single statement blocks
[] 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
[]
> @@ -746,20 +719,17 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
[]
>  	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
>  	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
> -	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff)
> -	{
> +	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
>  		if (param->u.crypt.idx >= WEP_KEYS
>  			|| param->u.crypt.idx >= BIP_MAX_KEYID
> -		)
> -		{
> +		) {

This one's a bit of an oddity as the close paren and open brace
should be on the line above.

additional trivia:

The tests could be changed in a separate patch to something like:

	if (is_broadcast_ether_addr(param->sta_addr)) {
		if (param->u.crypt.idx >= WEP_KEYS ||
		    param->u.crypt.idx >= BIP_MAX_KEYID) {

or maybe

	if (is_broadcast_ether_addr(param->sta_addr)) {
		if (param->u.crypt.idx >= min(WEP_KEYS, BIP_MAX_KEYID)) {






[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux