All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/1] net: pcs: xpcs: fix error handling on failed to allocate memory
@ 2021-08-10  8:58 Wong Vee Khee
  2021-08-11 11:47 ` Vladimir Oltean
  2021-08-11 22:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Wong Vee Khee @ 2021-08-10  8:58 UTC (permalink / raw)
  To: Jose Abreu, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Jakub Kicinski
  Cc: netdev, linux-kernel, Vladimir Oltean

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.

Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
 drivers/net/pcs/pcs-xpcs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-11 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  8:58 [PATCH net-next 1/1] net: pcs: xpcs: fix error handling on failed to allocate memory Wong Vee Khee
2021-08-11 11:47 ` Vladimir Oltean
2021-08-11 22:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.