linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/oid_registry.c: Remove redundant assignment to variable num
@ 2022-10-10 20:42 Colin Ian King
  0 siblings, 0 replies; 2+ messages in thread
From: Colin Ian King @ 2022-10-10 20:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: kernel-janitors, linux-kernel

The variable num is being assigned a value that is never read, it
is being re-assigned a new value in both paths of the following if/else
statement. The assignment is redundant, remove it.

Cleans up clang-scan warning:
warning: Value stored to 'num' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 lib/oid_registry.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/oid_registry.c b/lib/oid_registry.c
index e592d48b1974..fe6705cfd780 100644
--- a/lib/oid_registry.c
+++ b/lib/oid_registry.c
@@ -146,7 +146,6 @@ int sprint_oid(const void *data, size_t datasize, char *buffer, size_t bufsize)
 	bufsize -= count;
 
 	while (v < end) {
-		num = 0;
 		n = *v++;
 		if (!(n & 0x80)) {
 			num = n;
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] lib/oid_registry.c: remove redundant assignment to variable num
@ 2021-12-30 15:09 Colin Ian King
  0 siblings, 0 replies; 2+ messages in thread
From: Colin Ian King @ 2021-12-30 15:09 UTC (permalink / raw)
  To: Herbert Xu, Stefan Berger
  Cc: kernel-janitors, Nathan Chancellor, llvm, linux-kernel

The variable num is being assigned a value that is never read, it
is being re-assigned a value in both paths of the following if
statement. The assignment is redundant and can be removed.

Cleans up clang-scan warning:
lib/oid_registry.c:149:3: warning: Value stored to 'num' is never
read [deadcode.DeadStores]
                num = 0;

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 lib/oid_registry.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/oid_registry.c b/lib/oid_registry.c
index e592d48b1974..fe6705cfd780 100644
--- a/lib/oid_registry.c
+++ b/lib/oid_registry.c
@@ -146,7 +146,6 @@ int sprint_oid(const void *data, size_t datasize, char *buffer, size_t bufsize)
 	bufsize -= count;
 
 	while (v < end) {
-		num = 0;
 		n = *v++;
 		if (!(n & 0x80)) {
 			num = n;
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-10 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 20:42 [PATCH] lib/oid_registry.c: Remove redundant assignment to variable num Colin Ian King
  -- strict thread matches above, loose matches on Subject: below --
2021-12-30 15:09 [PATCH] lib/oid_registry.c: remove " Colin Ian King

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).