All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: atlantic: Signedness bug in aq_vec_isr_legacy()
@ 2019-11-13 18:31 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-11-13 18:31 UTC (permalink / raw)
  To: Igor Russkikh, Nikita Danilov; +Cc: David S. Miller, netdev, kernel-janitors

irqreturn_t type is an enum and in this context it's unsigned, so "err"
can't be irqreturn_t or it breaks the error handling.  In fact the "err"
variable is only used to store integers (never irqreturn_t) so it should
be declared as int.

I removed the initialization because it's not required.  Using a bogus
initializer turns off GCC's uninitialized variable warnings.  Secondly,
there is a GCC warning about unused assignments and we would like to
enable that feature eventually so we have been trying to remove these
unnecessary initializers.

Fixes: 7b0c342f1f67 ("net: atlantic: code style cleanup")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
index 6e19e27b6200..f40a427970dc 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
@@ -307,8 +307,8 @@ irqreturn_t aq_vec_isr(int irq, void *private)
 irqreturn_t aq_vec_isr_legacy(int irq, void *private)
 {
 	struct aq_vec_s *self = private;
-	irqreturn_t err = 0;
 	u64 irq_mask = 0U;
+	int err;
 
 	if (!self)
 		return IRQ_NONE;
-- 
2.11.0


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

* [PATCH] net: atlantic: Signedness bug in aq_vec_isr_legacy()
@ 2019-11-13 18:31 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-11-13 18:31 UTC (permalink / raw)
  To: Igor Russkikh, Nikita Danilov; +Cc: David S. Miller, netdev, kernel-janitors

irqreturn_t type is an enum and in this context it's unsigned, so "err"
can't be irqreturn_t or it breaks the error handling.  In fact the "err"
variable is only used to store integers (never irqreturn_t) so it should
be declared as int.

I removed the initialization because it's not required.  Using a bogus
initializer turns off GCC's uninitialized variable warnings.  Secondly,
there is a GCC warning about unused assignments and we would like to
enable that feature eventually so we have been trying to remove these
unnecessary initializers.

Fixes: 7b0c342f1f67 ("net: atlantic: code style cleanup")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
index 6e19e27b6200..f40a427970dc 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
@@ -307,8 +307,8 @@ irqreturn_t aq_vec_isr(int irq, void *private)
 irqreturn_t aq_vec_isr_legacy(int irq, void *private)
 {
 	struct aq_vec_s *self = private;
-	irqreturn_t err = 0;
 	u64 irq_mask = 0U;
+	int err;
 
 	if (!self)
 		return IRQ_NONE;
-- 
2.11.0

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

* Re: [PATCH] net: atlantic: Signedness bug in aq_vec_isr_legacy()
  2019-11-13 18:31 ` Dan Carpenter
@ 2019-11-13 22:33   ` David Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-11-13 22:33 UTC (permalink / raw)
  To: dan.carpenter; +Cc: irusskikh, ndanilov, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 13 Nov 2019 21:31:58 +0300

> irqreturn_t type is an enum and in this context it's unsigned, so "err"
> can't be irqreturn_t or it breaks the error handling.  In fact the "err"
> variable is only used to store integers (never irqreturn_t) so it should
> be declared as int.
> 
> I removed the initialization because it's not required.  Using a bogus
> initializer turns off GCC's uninitialized variable warnings.  Secondly,
> there is a GCC warning about unused assignments and we would like to
> enable that feature eventually so we have been trying to remove these
> unnecessary initializers.
> 
> Fixes: 7b0c342f1f67 ("net: atlantic: code style cleanup")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

* Re: [PATCH] net: atlantic: Signedness bug in aq_vec_isr_legacy()
@ 2019-11-13 22:33   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-11-13 22:33 UTC (permalink / raw)
  To: dan.carpenter; +Cc: irusskikh, ndanilov, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 13 Nov 2019 21:31:58 +0300

> irqreturn_t type is an enum and in this context it's unsigned, so "err"
> can't be irqreturn_t or it breaks the error handling.  In fact the "err"
> variable is only used to store integers (never irqreturn_t) so it should
> be declared as int.
> 
> I removed the initialization because it's not required.  Using a bogus
> initializer turns off GCC's uninitialized variable warnings.  Secondly,
> there is a GCC warning about unused assignments and we would like to
> enable that feature eventually so we have been trying to remove these
> unnecessary initializers.
> 
> Fixes: 7b0c342f1f67 ("net: atlantic: code style cleanup")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

end of thread, other threads:[~2019-11-13 22:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 18:31 [PATCH] net: atlantic: Signedness bug in aq_vec_isr_legacy() Dan Carpenter
2019-11-13 18:31 ` Dan Carpenter
2019-11-13 22:33 ` David Miller
2019-11-13 22:33   ` David Miller

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.