Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1588950
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Julia Lawall <julia.lawall@lip6.fr> |
| Newsgroups | linux.kernel |
| Subject | Re: [Outreachy kernel] [PATCH 2/5] staging: rtl8192u: Remove unnecessary else after return |
| Date | Mon, 27 Feb 2017 22:30:01 +0100 |
| Message-ID | <tfB1L-2XP-1@gated-at.bofh.it> (permalink) |
| References | <tfy3T-TW-9@gated-at.bofh.it> <tfy3U-TW-23@gated-at.bofh.it> |
| X-Ironport-Av | E=Sophos;i="5.35,215,1484002800"; d="scan'208";a="262318148" |
| X-X-Sender | jll@hadrien |
| User-Agent | Alpine 2.20 (DEB 67 2015-01-07) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 39 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | gregkh@linuxfoundation.org, lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, outreachy-kernel@googlegroups.com |
| X-Original-Date | Mon, 27 Feb 2017 22:25:23 +0100 (CET) |
| X-Original-Message-ID | <alpine.DEB.2.20.1702272224290.2127@hadrien> |
| X-Original-References | <1488219268-3006-1-git-send-email-singhalsimran0@gmail.com> <1488219268-3006-2-git-send-email-singhalsimran0@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1588950 |
Show key headers only | View raw
On Mon, 27 Feb 2017, simran singhal wrote:
> This patch fixes the checkpatch warning that else is not generally
> useful after a break or return.
>
> This was done using Coccinelle:
>
> @@
> expression e2;
> statement s1;
> @@
> if(e2) { ... return ...; }
> -else
> s1
>
> Signed-off-by: simran singhal <singhalsimran0@gmail.com>
> ---
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> index 2453413..4d6c928 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> @@ -374,8 +374,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
>
> if (!tcb_desc->bHwSec)
> return ret;
> - else
> - return 0;
> + return 0;
In contrast to another patch I commented on, it seems likely that here 0
means success. Converting 0 to false when that is what it means (ie not
here) makes the code more understandable.
julia
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/5] staging: lustre: Remove unnecessary else after return simran singhal <singhalsimran0@gmail.com> - 2017-02-27 19:20 +0100
[PATCH 2/5] staging: rtl8192u: Remove unnecessary else after return simran singhal <singhalsimran0@gmail.com> - 2017-02-27 19:20 +0100
Re: [Outreachy kernel] [PATCH 2/5] staging: rtl8192u: Remove unnecessary else after return Julia Lawall <julia.lawall@lip6.fr> - 2017-02-27 22:30 +0100
Re: [PATCH 1/5] staging: lustre: Remove unnecessary else after return Joe Perches <joe@perches.com> - 2017-02-27 21:00 +0100
Re: [PATCH 1/5] staging: lustre: Remove unnecessary else after return SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-02-27 21:30 +0100
Re: [PATCH 1/5] staging: lustre: Remove unnecessary else after return Joe Perches <joe@perches.com> - 2017-02-27 21:50 +0100
Re: [PATCH 1/5] staging: lustre: Remove unnecessary else after return SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-02-28 20:40 +0100
Re: [Outreachy kernel] Re: [PATCH 1/5] staging: lustre: Remove unnecessary else after return Julia Lawall <julia.lawall@lip6.fr> - 2017-03-01 03:10 +0100
csiph-web