net: phy: phylink: Handle NULL fwnode_handle

Unlike the various of_* routines to fetch properties, fwnode_* routines can
have an early check against a NULL fwnode_handle reference which makes them
return -EINVAL (see fwnode_call_int_op), thus making it virtually impossible to
differentiate what type of error is going on.

Have an early check in phylink_register_sfp() so we can keep proceeding with
the initialization, there is not much we can do without a valid fwnode_handle
except return early and treat this similarly to -ENOENT.

Fixes: 8fa7b9b6af ("phylink: convert to fwnode")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Florian Fainelli 2017-12-14 15:57:58 -08:00 committed by David S. Miller
parent 245d21190a
commit 024778095a

View File

@ -506,6 +506,9 @@ static int phylink_register_sfp(struct phylink *pl,
struct fwnode_reference_args ref;
int ret;
if (!fwnode)
return 0;
ret = fwnode_property_get_reference_args(fwnode, "sfp", NULL,
0, 0, &ref);
if (ret < 0) {