diff mbox

[v2,1/2] net: dsa: Error out on tagging protocol mismatches

Message ID 1414187045-8326-2-git-send-email-andrew@lunn.ch
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Andrew Lunn Oct. 24, 2014, 9:44 p.m. UTC
If there is a mismatch between enabled tagging protocols and the
protocol the switch supports, error out, rather than continue with a
situation which is unlikely to work.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
cc: alexander.h.duyck@intel.com
---

v2: Handle the use case of DSA_TAG_PROTO_NONE

 net/dsa/dsa.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Florian Fainelli Oct. 24, 2014, 10:42 p.m. UTC | #1
On 10/24/2014 02:44 PM, Andrew Lunn wrote:
> If there is a mismatch between enabled tagging protocols and the
> protocol the switch supports, error out, rather than continue with a
> situation which is unlikely to work.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

> cc: alexander.h.duyck@intel.com
> ---
> 
> v2: Handle the use case of DSA_TAG_PROTO_NONE
> 
>  net/dsa/dsa.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 22f34cf4cb27..6317b41c99b0 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -174,8 +174,11 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
>  			dst->rcv = brcm_netdev_ops.rcv;
>  			break;
>  #endif
> -		default:
> +		case DSA_TAG_PROTO_NONE:
>  			break;
> +		default:
> +			ret = -ENOPROTOOPT;
> +			goto out;
>  		}
>  
>  		dst->tag_protocol = drv->tag_protocol;
> 

--
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
diff mbox

Patch

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 22f34cf4cb27..6317b41c99b0 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -174,8 +174,11 @@  dsa_switch_setup(struct dsa_switch_tree *dst, int index,
 			dst->rcv = brcm_netdev_ops.rcv;
 			break;
 #endif
-		default:
+		case DSA_TAG_PROTO_NONE:
 			break;
+		default:
+			ret = -ENOPROTOOPT;
+			goto out;
 		}
 
 		dst->tag_protocol = drv->tag_protocol;