Return directly from within the loop as soon as the port is found,
otherwise we won't return NULL if the end of the list is reached.
Fixes: b96ddf254b09 ("net: dsa: use ports list in dsa_to_port")
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
{
struct dsa_switch_tree *dst = ds->dst;
static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
{
struct dsa_switch_tree *dst = ds->dst;
- struct dsa_port *dp = NULL;
list_for_each_entry(dp, &dst->ports, list)
if (dp->ds == ds && dp->index == p)
list_for_each_entry(dp, &dst->ports, list)
if (dp->ds == ds && dp->index == p)
}
static inline bool dsa_is_unused_port(struct dsa_switch *ds, int p)
}
static inline bool dsa_is_unused_port(struct dsa_switch *ds, int p)