public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Chandra Pratap <chandrapratap3519@gmail.com>
Cc: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com,
	gregkh@linuxfoundation.org, linux-fbdev@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	outreachy@lists.linux.dev
Subject: Re: [PATCH] staging: sm750fb: Replace comparisons with NULL and 0
Date: Wed, 20 Mar 2024 08:08:15 +0300	[thread overview]
Message-ID: <c4a5e9e8-214a-4ac0-b8ee-01a9e7a1e5f9@moroto.mountain> (raw)
In-Reply-To: <20240319181735.366565-1-chandrapratap3519@gmail.com>

On Tue, Mar 19, 2024 at 11:47:35PM +0530, Chandra Pratap wrote:
> Replace '(foo != NULL)' with '(foo)' and 'x != 0'
> with 'x' to adhere to the coding standards.
> 

In your commit message use "opt" and "*opt" instead of "foo" and "x".

Removing the != NULL is fine, but the *opt != 0 should be changed to
(*opt != '\0').  There are times where comparing against zero helps
readability.  I wrote a blog about this, but I had forgotten the case
with the NUL terminator...

https://staticthinking.wordpress.com/2024/02/20/when-to-use-0/

regards,
dan carpenter


  reply	other threads:[~2024-03-20  5:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 18:17 [PATCH] staging: sm750fb: Replace comparisons with NULL and 0 Chandra Pratap
2024-03-20  5:08 ` Dan Carpenter [this message]
2024-03-20 18:09   ` [PATCH v2] " Chandra Pratap
2024-03-21  5:41     ` Dan Carpenter
2024-03-22  9:49     ` Greg KH
2024-03-22 14:10       ` [PATCH v3] " Chandra Pratap
2024-03-22 14:25         ` Greg KH
2024-03-22 15:16       ` Chandra Pratap
2024-03-23  2:59         ` Alison Schofield
  -- strict thread matches above, loose matches on Subject: below --
2024-03-15 13:01 [PATCH] " Chandra Pratap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4a5e9e8-214a-4ac0-b8ee-01a9e7a1e5f9@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=chandrapratap3519@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=outreachy@lists.linux.dev \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=teddy.wang@siliconmotion.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox