]> git.baikalelectronics.ru Git - kernel.git/commit
net: pcs: xpcs: fix error handling on failed to allocate memory
authorWong Vee Khee <vee.khee.wong@linux.intel.com>
Tue, 10 Aug 2021 08:58:12 +0000 (16:58 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 11 Aug 2021 21:50:54 +0000 (14:50 -0700)
commit323f6a4017e01f7b9b4f585f60c9f00854e85df9
treea9347c1c281a16599af9ab01552287576334370e
parent46486795727a6c0504ed3c837a839611131e92e1
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: 008ad8a31f0a ("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>
drivers/net/pcs/pcs-xpcs.c