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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 B87A5C433ED for ; Tue, 6 Apr 2021 10:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C824613CA for ; Tue, 6 Apr 2021 10:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245284AbhDFK7I (ORCPT ); Tue, 6 Apr 2021 06:59:08 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:51513 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234101AbhDFK7H (ORCPT ); Tue, 6 Apr 2021 06:59:07 -0400 IronPort-HdrOrdr: =?us-ascii?q?A9a23=3Al9gs6qguLlDkq2Ib8TFDVPJlV3BQXgQji2hD?= =?us-ascii?q?6mlwRA09T+WzkceykPMHkSLlkTp5YgBCpfmsGomlBUnd+5l8/JULMd6ZNzXOlW?= =?us-ascii?q?O0IOhZgrfK7CbnH0TFmNJ18YdFX+xABMbrDV585Pyb3CCdH8w7yNeKtICE7N2+?= =?us-ascii?q?815XQQtna75t4m5CY27wLmRNWAJECZAlfaDx2uN7oVObFEgqUg=3D=3D?= X-IronPort-AV: E=Sophos;i="5.81,309,1610406000"; d="scan'208";a="377853947" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2021 12:58:58 +0200 Date: Tue, 6 Apr 2021 12:58:58 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Zhansaya Bagdauletkyzy cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com Subject: Re: [Outreachy kernel] [PATCH 1/2] staging: rtl8712: Rewrite NULL comparisons In-Reply-To: <5d2db1d233030ececcdd4934ca9c46cb998c0c5b.1617705825.git.zhansayabagdaulet@gmail.com> Message-ID: References: <5d2db1d233030ececcdd4934ca9c46cb998c0c5b.1617705825.git.zhansayabagdaulet@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 6 Apr 2021, Zhansaya Bagdauletkyzy wrote: > Replace NULL comparisons with boolean negation. This summarizes concisely what you did, which is helpful, but you could also say why. For example, to make the code more concise or to improve readability or for consistency with the rest of the code base. julia > Reported by checkpatch. > > Signed-off-by: Zhansaya Bagdauletkyzy > --- > drivers/staging/rtl8712/rtl871x_recv.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/rtl8712/rtl871x_recv.h b/drivers/staging/rtl8712/rtl871x_recv.h > index 7c9995060a6f..4aa39f4f3b84 100644 > --- a/drivers/staging/rtl8712/rtl871x_recv.h > +++ b/drivers/staging/rtl8712/rtl871x_recv.h > @@ -135,7 +135,7 @@ int recv_func(struct _adapter *padapter, void *pcontext); > static inline u8 *get_rxmem(union recv_frame *precvframe) > { > /* always return rx_head... */ > - if (precvframe == NULL) > + if (!precvframe) > return NULL; > return precvframe->u.hdr.rx_head; > } > @@ -143,7 +143,7 @@ static inline u8 *get_rxmem(union recv_frame *precvframe) > static inline u8 *get_recvframe_data(union recv_frame *precvframe) > { > /* always return rx_data */ > - if (precvframe == NULL) > + if (!precvframe) > return NULL; > return precvframe->u.hdr.rx_data; > } > @@ -153,7 +153,7 @@ static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz) > /* used for extract sz bytes from rx_data, update rx_data and return > * the updated rx_data to the caller > */ > - if (precvframe == NULL) > + if (!precvframe) > return NULL; > precvframe->u.hdr.rx_data += sz; > if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) { > @@ -170,7 +170,7 @@ static inline u8 *recvframe_put(union recv_frame *precvframe, sint sz) > * return the updated rx_tail to the caller > * after putting, rx_tail must be still larger than rx_end. > */ > - if (precvframe == NULL) > + if (!precvframe) > return NULL; > precvframe->u.hdr.rx_tail += sz; > if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) { > @@ -188,7 +188,7 @@ static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz) > * updated rx_end to the caller > * after pulling, rx_end must be still larger than rx_data. > */ > - if (precvframe == NULL) > + if (!precvframe) > return NULL; > precvframe->u.hdr.rx_tail -= sz; > if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) { > -- > 2.25.1 > > -- > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/5d2db1d233030ececcdd4934ca9c46cb998c0c5b.1617705825.git.zhansayabagdaulet%40gmail.com. >