From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B207EC433DB for ; Thu, 24 Dec 2020 17:16:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EEF3224B1 for ; Thu, 24 Dec 2020 17:16:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728851AbgLXRQn (ORCPT ); Thu, 24 Dec 2020 12:16:43 -0500 Received: from smtprelay0179.hostedemail.com ([216.40.44.179]:53074 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727081AbgLXRQn (ORCPT ); Thu, 24 Dec 2020 12:16:43 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 8589B837F27B; Thu, 24 Dec 2020 17:15:59 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: space81_481839827473 X-Filterd-Recvd-Size: 3587 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf15.hostedemail.com (Postfix) with ESMTPA; Thu, 24 Dec 2020 17:15:58 +0000 (UTC) Message-ID: <62a06f2c17df6ecac4a64a0c0d3af67fc1f54461.camel@perches.com> Subject: Re: [PATCH] staging: rtl8723bs: clean up brace coding style issues From: Joe Perches To: Michael Straube , gregkh@linuxfoundation.org Cc: hdegoede@redhat.com, Larry.Finger@lwfinger.net, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Thu, 24 Dec 2020 09:15:56 -0800 In-Reply-To: <20201222141707.31972-1-straube.linux@gmail.com> References: <20201222141707.31972-1-straube.linux@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-12-22 at 15:17 +0100, Michael Straube wrote: > Add missing braces around else arm of if else statement to clear > style issues reported by checkpatch. > > CHECK: braces {} should be used on all arms of this statement > CHECK: Unbalanced braces around else statement [] > diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c [] > @@ -245,8 +245,9 @@ u16 Address) >   break; >   } >   return rtw_read8(Adapter, EFUSE_CTRL); > - } else > + } else { >   return 0xFF; > + } Instead, when you see a pattern like this it's generally better to reverse whatever test is above this, return early and unindent the block above the else. Here that would be: --- diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c index 32ca10f01413..e5c3dba5c8ae 100644 --- a/drivers/staging/rtl8723bs/core/rtw_efuse.c +++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c @@ -222,31 +222,31 @@ u16 Address) EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false); - if (Address < contentLen) {/* E-fuse 512Byte */ - /* Write E-fuse Register address bit0~7 */ - temp = Address & 0xFF; - rtw_write8(Adapter, EFUSE_CTRL+1, temp); - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); - /* Write E-fuse Register address bit8~9 */ - temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); - rtw_write8(Adapter, EFUSE_CTRL+2, temp); - - /* Write 0x30[31]= 0 */ - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); - temp = Bytetemp & 0x7F; - rtw_write8(Adapter, EFUSE_CTRL+3, temp); + if (Address >= contentLen) /* E-fuse 512Byte */ + return 0xFF; - /* Wait Write-ready (0x30[31]= 1) */ + /* Write E-fuse Register address bit0~7 */ + temp = Address & 0xFF; + rtw_write8(Adapter, EFUSE_CTRL+1, temp); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); + /* Write E-fuse Register address bit8~9 */ + temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); + rtw_write8(Adapter, EFUSE_CTRL+2, temp); + + /* Write 0x30[31]= 0 */ + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); + temp = Bytetemp & 0x7F; + rtw_write8(Adapter, EFUSE_CTRL+3, temp); + + /* Wait Write-ready (0x30[31]= 1) */ + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); + while (!(Bytetemp & 0x80)) { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); - while (!(Bytetemp & 0x80)) { - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); - k++; - if (k == 1000) - break; - } - return rtw_read8(Adapter, EFUSE_CTRL); - } else - return 0xFF; + k++; + if (k == 1000) + break; + } + return rtw_read8(Adapter, EFUSE_CTRL); } /* EFUSE_Read1Byte */