Message ID | 20210810085812.1808466-1-vee.khee.wong@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 2cad5d2ed1b47eded5a2f2372c2a94bb065a8f97 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,1/1] net: pcs: xpcs: fix error handling on failed to allocate memory | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Tue, Aug 10, 2021 at 04:58:12PM +0800, Wong Vee Khee wrote: > 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 > I know I changed my mind, but seeing that Intel's Alder Lake S patches are likely going to stall for a while due to ungoing design discussions: https://patchwork.kernel.org/project/netdevbpf/patch/20210809102229.933748-2-vee.khee.wong@linux.intel.com/ the net -> net-next merge might not be so far in the future after all. So could this patch be applied to the "net" tree after all? According to the cadence of the last 2 net -> net-next merges, which were on Jul 31 and Aug 5, the next one should be soon-ish. The patch is fine: Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Fixes: 3ad1d171548e ("net: dsa: sja1105: migrate to xpcs for SGMII")
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Tue, 10 Aug 2021 16:58:12 +0800 you wrote: > 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> > > [...] Here is the summary with links: - [net-next,1/1] net: pcs: xpcs: fix error handling on failed to allocate memory https://git.kernel.org/netdev/net/c/2cad5d2ed1b4 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
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;
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(-)