All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Li <yang.lee@linux.alibaba.com>
To: kuba@kernel.org
Cc: davem@davemloft.net, ralf@linux-mips.org, edumazet@google.com,
	pabeni@redhat.com, linux-hams@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yang Li <yang.lee@linux.alibaba.com>,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: [PATCH net-next] net: rose: Remove NULL check before dev_{put, hold}
Date: Tue, 28 Feb 2023 08:52:17 +0800	[thread overview]
Message-ID: <20230228005217.105058-1-yang.lee@linux.alibaba.com> (raw)

The call netdev_{put, hold} of dev_{put, hold} will check NULL,
so there is no need to check before using dev_{put, hold},
remove it to silence the warning:

./net/rose/rose_route.c:619:2-10: WARNING: NULL check before dev_{put, hold} functions is not needed.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4239
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 net/rose/rose_route.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index fee772b4637c..58d0312c0119 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -615,8 +615,7 @@ struct net_device *rose_dev_first(void)
 			if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
 				first = dev;
 	}
-	if (first)
-		dev_hold(first);
+	dev_hold(first);
 	rcu_read_unlock();
 
 	return first;
-- 
2.20.1.7.g153144c


WARNING: multiple messages have this Message-ID (diff)
From: Yang Li <yang.lee@linux.alibaba.com>
To: kuba@kernel.org
Cc: davem@davemloft.net, ralf@linux-mips.org, edumazet@google.com,
	pabeni@redhat.com, linux-hams@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yang Li <yang.lee@linux.alibaba.com>,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: [PATCH net-next] net: rose: Remove NULL check before dev_{put, hold}
Date: Tue, 28 Feb 2023 08:52:17 +0800	[thread overview]
Message-ID: <20230228005217.105058-1-yang.lee@linux.alibaba.com> (raw)

The call netdev_{put, hold} of dev_{put, hold} will check NULL,
so there is no need to check before using dev_{put, hold},
remove it to silence the warning:

./net/rose/rose_route.c:619:2-10: WARNING: NULL check before dev_{put, hold} functions is not needed.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4239
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 net/rose/rose_route.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index fee772b4637c..58d0312c0119 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -615,8 +615,7 @@ struct net_device *rose_dev_first(void)
 			if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
 				first = dev;
 	}
-	if (first)
-		dev_hold(first);
+	dev_hold(first);
 	rcu_read_unlock();
 
 	return first;
-- 
2.20.1.7.g153144c


             reply	other threads:[~2023-02-28  0:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28  0:52 Yang Li [this message]
2023-02-28  0:52 ` [PATCH net-next] net: rose: Remove NULL check before dev_{put, hold} Yang Li
2023-02-28  2:33 ` Jakub Kicinski
2023-02-28  2:33   ` Jakub Kicinski

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=20230228005217.105058-1-yang.lee@linux.alibaba.com \
    --to=yang.lee@linux.alibaba.com \
    --cc=abaci@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-hams@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ralf@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.