linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zhong jiang <zhongjiang@huawei.com>
To: <davem@davemloft.net>
Cc: <vz@mleia.com>, <slemieux.tyco@gmail.com>,
	<keescook@chromium.org>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] ethernet: declance:  Use NULL to compare with pointer-typed value rather than 0
Date: Sat, 18 Aug 2018 14:29:32 +0800	[thread overview]
Message-ID: <1534573773-17358-2-git-send-email-zhongjiang@huawei.com> (raw)
In-Reply-To: <1534573773-17358-1-git-send-email-zhongjiang@huawei.com>

We should use NULL to compare with pointer-typed value rather than
0. The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/net/ethernet/amd/declance.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c
index 116997a..c636f02 100644
--- a/drivers/net/ethernet/amd/declance.c
+++ b/drivers/net/ethernet/amd/declance.c
@@ -606,8 +606,7 @@ static int lance_rx(struct net_device *dev)
 		} else {
 			len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4;
 			skb = netdev_alloc_skb(dev, len + 2);
-
-			if (skb == 0) {
+			if (!skb) {
 				dev->stats.rx_dropped++;
 				*rds_ptr(rd, mblength, lp->type) = 0;
 				*rds_ptr(rd, rmd1, lp->type) =
-- 
1.7.12.4


  reply	other threads:[~2018-08-18  6:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-18  6:29 [PATCH 0/2] ethernet: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
2018-08-18  6:29 ` zhong jiang [this message]
2018-08-18  6:29 ` [PATCH 2/2] ethernet: lpc_eth: " zhong jiang
2018-08-18  6:45 ` [PATCH 0/2] ethernet: " zhong jiang
  -- strict thread matches above, loose matches on Subject: below --
2018-08-17 13:18 zhong jiang
2018-08-17 13:18 ` [PATCH 1/2] ethernet: declance: " zhong jiang

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=1534573773-17358-2-git-send-email-zhongjiang@huawei.com \
    --to=zhongjiang@huawei.com \
    --cc=davem@davemloft.net \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=slemieux.tyco@gmail.com \
    --cc=vz@mleia.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;
as well as URLs for NNTP newsgroup(s).