X-Git-Url: https://git.stricted.de/?a=blobdiff_plain;f=net%2Fdsa%2Fdsa.c;h=2bc62ea857c8b6842c27ed9d6ee12b564fb2d1e6;hb=69086a78bdc973ec0b722be790b146e84ba8a8c4;hp=45295ca095717314294e1be8172a6e852fe1a679;hpb=5a0fbc6d9c79ddf9cd22e6573e54e97e48fbb13e;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 45295ca09571..2bc62ea857c8 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -80,6 +80,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, int ret; char *name; int i; + bool valid_name_found = false; /* * Probe for switch model. @@ -131,8 +132,13 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, } else { ds->phys_port_mask |= 1 << i; } + valid_name_found = true; } + if (!valid_name_found && i == DSA_MAX_PORTS) { + ret = -EINVAL; + goto out; + } /* * If the CPU connects to this switch, set the switch tree