net: phy: phylink: Handle NULL fwnode_handle
Subsystems (4)
PATCH 1/1 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.
--- drivers/net/phy/phylink.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/phy/phylink.c +3 -0
@@ -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 ) {
Signature · 1 line
2.14.1
Quoted 11 lines · Florian Fainelli
Unlike the various of_* routines to fetch properties, fwnode_* routines can have an early check against a NULL
fwnode_handlereference which makes them return-EINVAL(seefwnode_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 validfwnode_handleexcept return early and treat this similarly to-ENOENT.Fixes 8fa7b9b6af25 ("phylink: convert to fwnode")Signed-off-by Florian Fainelli <[email protected]>
Thanks Florian.
Quoted 21 lines
--- drivers/net/phy/phylink.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/phy/phylink.c +3
-0@@ -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 ) {Signature · 1 line
2.14.1
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
From: Florian Fainelli <[email protected]>
Date: Thu, 14 Dec 2017 15:57:58 -0800
Quoted 11 lines
Unlike the various of_* routines to fetch properties, fwnode_* routines can have an early check against a NULL
fwnode_handlereference which makes them return-EINVAL(seefwnode_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 validfwnode_handleexcept return early and treat this similarly to-ENOENT.Fixes 8fa7b9b6af25 ("phylink: convert to fwnode")Signed-off-by Florian Fainelli <[email protected]>
Applied.