kernel_optimize_test/net/dsa
Florian Fainelli 24595346d7 net: dsa: Properly propagate errors from dsa_switch_setup_one
While shuffling some code around, dsa_switch_setup_one() was introduced,
and it was modified to return either an error code using ERR_PTR() or a
NULL pointer when running out of memory or failing to setup a switch.

This is a problem for its caler: dsa_switch_setup() which uses IS_ERR()
and expects to find an error code, not a NULL pointer, so we still try
to proceed with dsa_switch_setup() and operate on invalid memory
addresses. This can be easily reproduced by having e.g: the bcm_sf2
driver built-in, but having no such switch, such that drv->setup will
fail.

Fix this by using PTR_ERR() consistently which is both more informative
and avoids for the caller to use IS_ERR_OR_NULL().

Fixes: df197195a5 ("net: dsa: split dsa_switch_setup into two functions")
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-31 21:50:34 -07:00
..
dsa_priv.h net: dsa: integrate with SWITCHDEV for HW bridging 2015-02-25 17:03:38 -05:00
dsa.c net: dsa: Properly propagate errors from dsa_switch_setup_one 2015-05-31 21:50:34 -07:00
Kconfig net: dsa: make NET_DSA manually selectable from the config 2015-03-20 21:37:58 -04:00
Makefile
slave.c dsa: implement ndo_get_iflink 2015-04-02 14:05:01 -04:00
tag_brcm.c
tag_dsa.c
tag_edsa.c
tag_trailer.c