* [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state
@ 2015-04-16 5:12 Guenter Roeck
2015-04-16 12:37 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Guenter Roeck @ 2015-04-16 5:12 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-kernel, Guenter Roeck
Return correct error code if _mv88e6xxx_reg_read returns an error.
Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging support")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/net/dsa/mv88e6xxx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index fc8d3b6ffe8e..f64186a5f634 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -908,8 +908,10 @@ static int mv88e6xxx_set_port_state(struct dsa_switch *ds, int port, u8 state)
mutex_lock(&ps->smi_mutex);
reg = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_CONTROL);
- if (reg < 0)
+ if (reg < 0) {
+ ret = reg;
goto abort;
+ }
oldstate = reg & PORT_CONTROL_STATE_MASK;
if (oldstate != state) {
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state
2015-04-16 5:12 [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state Guenter Roeck
@ 2015-04-16 12:37 ` Andrew Lunn
2015-04-16 12:51 ` Guenter Roeck
2015-04-16 13:46 ` Guenter Roeck
2015-04-16 16:13 ` David Miller
2 siblings, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2015-04-16 12:37 UTC (permalink / raw)
To: Guenter Roeck; +Cc: David S. Miller, netdev, linux-kernel
On Wed, Apr 15, 2015 at 10:12:42PM -0700, Guenter Roeck wrote:
> Return correct error code if _mv88e6xxx_reg_read returns an error.
>
> Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging support")
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Hi Guenter
Good catch. I'm surprised there is no compiler warning, possibly used
before set.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Thanks
Andrew
> ---
> drivers/net/dsa/mv88e6xxx.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
> index fc8d3b6ffe8e..f64186a5f634 100644
> --- a/drivers/net/dsa/mv88e6xxx.c
> +++ b/drivers/net/dsa/mv88e6xxx.c
> @@ -908,8 +908,10 @@ static int mv88e6xxx_set_port_state(struct dsa_switch *ds, int port, u8 state)
> mutex_lock(&ps->smi_mutex);
>
> reg = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_CONTROL);
> - if (reg < 0)
> + if (reg < 0) {
> + ret = reg;
> goto abort;
> + }
>
> oldstate = reg & PORT_CONTROL_STATE_MASK;
> if (oldstate != state) {
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state
2015-04-16 12:37 ` Andrew Lunn
@ 2015-04-16 12:51 ` Guenter Roeck
0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2015-04-16 12:51 UTC (permalink / raw)
To: Andrew Lunn; +Cc: David S. Miller, netdev, linux-kernel
On 04/16/2015 05:37 AM, Andrew Lunn wrote:
> On Wed, Apr 15, 2015 at 10:12:42PM -0700, Guenter Roeck wrote:
>> Return correct error code if _mv88e6xxx_reg_read returns an error.
>>
>> Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging support")
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>
> Hi Guenter
>
> Good catch. I'm surprised there is no compiler warning, possibly used
> before set.
>
There was, actually. No idea how I missed that. Fengguang's build bots caught it.
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>
Thanks!
Guenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state
2015-04-16 5:12 [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state Guenter Roeck
2015-04-16 12:37 ` Andrew Lunn
@ 2015-04-16 13:46 ` Guenter Roeck
2015-04-16 18:51 ` Geert Uytterhoeven
2015-04-16 16:13 ` David Miller
2 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2015-04-16 13:46 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-kernel
On 04/15/2015 10:12 PM, Guenter Roeck wrote:
> Return correct error code if _mv88e6xxx_reg_read returns an error.
>
> Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging support")
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
I should have given proper credit.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
For the curious, neither W=1, W=2, C-1, C=2, nor sparse report this problem,
at least not with gcc 4.9.1.
Guenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state
2015-04-16 5:12 [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state Guenter Roeck
2015-04-16 12:37 ` Andrew Lunn
2015-04-16 13:46 ` Guenter Roeck
@ 2015-04-16 16:13 ` David Miller
2 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-04-16 16:13 UTC (permalink / raw)
To: linux; +Cc: netdev, linux-kernel
From: Guenter Roeck <linux@roeck-us.net>
Date: Wed, 15 Apr 2015 22:12:42 -0700
> Return correct error code if _mv88e6xxx_reg_read returns an error.
>
> Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging support")
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state
2015-04-16 13:46 ` Guenter Roeck
@ 2015-04-16 18:51 ` Geert Uytterhoeven
2015-04-17 2:05 ` Guenter Roeck
0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2015-04-16 18:51 UTC (permalink / raw)
To: Guenter Roeck; +Cc: David S. Miller, netdev, linux-kernel
On Thu, Apr 16, 2015 at 3:46 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On 04/15/2015 10:12 PM, Guenter Roeck wrote:
>>
>> Return correct error code if _mv88e6xxx_reg_read returns an error.
>>
>> Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging
>> support")
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>
>
> I should have given proper credit.
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>
> For the curious, neither W=1, W=2, C-1, C=2, nor sparse report this problem,
> at least not with gcc 4.9.1.
Good old gcc 4.1.2 (which I still use for m68k builds, and won't retire anytime
soon as it finds real bugs in every new kernel release) says:
drivers/net/dsa/mv88e6xxx.c: In function ‘mv88e6xxx_set_port_state’:
drivers/net/dsa/mv88e6xxx.c:905: warning: ‘ret’ may be used
uninitialized in this function
Even after your patch, as it missed one case (patch sent).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state
2015-04-16 18:51 ` Geert Uytterhoeven
@ 2015-04-17 2:05 ` Guenter Roeck
0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2015-04-17 2:05 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: David S. Miller, netdev, linux-kernel
On 04/16/2015 11:51 AM, Geert Uytterhoeven wrote:
> On Thu, Apr 16, 2015 at 3:46 PM, Guenter Roeck <linux@roeck-us.net> wrote:
>> On 04/15/2015 10:12 PM, Guenter Roeck wrote:
>>>
>>> Return correct error code if _mv88e6xxx_reg_read returns an error.
>>>
>>> Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging
>>> support")
>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>>
>>
>> I should have given proper credit.
>>
>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>>
>> For the curious, neither W=1, W=2, C-1, C=2, nor sparse report this problem,
>> at least not with gcc 4.9.1.
>
> Good old gcc 4.1.2 (which I still use for m68k builds, and won't retire anytime
> soon as it finds real bugs in every new kernel release) says:
>
> drivers/net/dsa/mv88e6xxx.c: In function ‘mv88e6xxx_set_port_state’:
> drivers/net/dsa/mv88e6xxx.c:905: warning: ‘ret’ may be used
> uninitialized in this function
>
> Even after your patch, as it missed one case (patch sent).
>
Grumble. So much for trusting tools :-(
Thanks for fixing this!
Guenter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-04-17 2:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 5:12 [PATCH] dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_state Guenter Roeck
2015-04-16 12:37 ` Andrew Lunn
2015-04-16 12:51 ` Guenter Roeck
2015-04-16 13:46 ` Guenter Roeck
2015-04-16 18:51 ` Geert Uytterhoeven
2015-04-17 2:05 ` Guenter Roeck
2015-04-16 16:13 ` 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.