diff options
author | Wong Vee Khee <vee.khee.wong@linux.intel.com> | 2021-08-10 10:58:12 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-08-11 23:50:54 +0200 |
commit | 2cad5d2ed1b47eded5a2f2372c2a94bb065a8f97 (patch) | |
tree | a9347c1c281a16599af9ab01552287576334370e /drivers/net | |
parent | net: linkwatch: fix failure to restore device state across suspend/resume (diff) | |
download | linux-2cad5d2ed1b47eded5a2f2372c2a94bb065a8f97.tar.xz linux-2cad5d2ed1b47eded5a2f2372c2a94bb065a8f97.zip |
net: pcs: xpcs: fix error handling on failed to allocate memory
Drivers such as sja1105 and stmmac that call xpcs_create() expects an
error returned by the pcs-xpcs module, but this was not the case on
failed to allocate memory.
Fixed this by returning an -ENOMEM instead of a NULL pointer.
Fixes: 3ad1d171548e ("net: dsa: sja1105: migrate to xpcs for SGMII")
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20210810085812.1808466-1-vee.khee.wong@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/pcs/pcs-xpcs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 63fda3fc40aa..4bd61339823c 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1089,7 +1089,7 @@ struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev, xpcs = kzalloc(sizeof(*xpcs), GFP_KERNEL); if (!xpcs) - return NULL; + return ERR_PTR(-ENOMEM); xpcs->mdiodev = mdiodev; |