mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Subject: [PATCH v2 0/4] staging: octeon: Clean up PHY interfaces and fix race conditions
@ 2026-11-08  2:07 Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 1/4] staging: octeon: add kernel-doc to ethernet-sgmii.c functions Oscar Alejandro Sánchez Lucero via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08  2:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero

This series provides a comprehensive clean-up, documentation alignment, and 
critical bug fixes for the Cavium Octeon staging ethernet PHY interfaces 
(SGMII, MDIO, RGMII, and SPI).

- v2: Consolidated the individual floating patches into a single 
  well-ordered patch series as requested by the maintainer.
- Investigation: Patches were identified through manual code analysis of the 
  staging driver directory, inspecting resource lifetimes on initialization 
  routines, checking error rollback pathways, and reviewing compliance with 
  kernel-doc scripting definitions.
- Testing: All patches in this series were successfully verified and built 
  via cross-compilation for the MIPS architecture using the mips64-linux-gnu- 
  toolchain with explicit W=1 compilation flags, ensuring zero compilation 
  warnings or errors. Style formatting was audited via scripts/checkpatch.pl --strict.

Oscar Alejandro Sánchez Lucero (4):
  staging: octeon: add kernel-doc to ethernet-sgmii.c functions
  staging: octeon: fix OF node leak and kernel-doc in ethernet-mdio.c
  staging: octeon: fix race condition and log macro in ethernet-rgmii.c
  staging: octeon: fix IRQ leak error path and remove dst.h from ethernet-spi.c

Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
Oscar Alejandro Sánchez Lucero (4):
      staging: octeon: add kernel-doc to ethernet-sgmii.c functions
      staging: octeon: fix OF node leak and kernel-doc in ethernet-mdio.c
      staging: octeon: fix race condition and log macro in ethernet-rgmii.c
      staging: octeon: fix IRQ leak error path and remove dst.h from ethernet-spi.c

 drivers/staging/octeon/ethernet-mdio.c  |  6 ++++--
 drivers/staging/octeon/ethernet-rgmii.c | 12 +++++-------
 drivers/staging/octeon/ethernet-sgmii.c | 12 ++++++++++++
 drivers/staging/octeon/ethernet-spi.c   | 10 ++++++++--
 4 files changed, 29 insertions(+), 11 deletions(-)
---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
change-id: 20261107-octeon-phy-series-v2-feb5b7a10d5f

Best regards,
-- 
Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>



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

* [PATCH 1/4] staging: octeon: add kernel-doc to ethernet-sgmii.c functions
  2026-11-08  2:07 [PATCH 0/4] Subject: [PATCH v2 0/4] staging: octeon: Clean up PHY interfaces and fix race conditions Oscar Alejandro Sánchez Lucero via B4 Relay
@ 2026-11-08  2:07 ` Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 2/4] staging: octeon: fix OF node leak and kernel-doc in ethernet-mdio.c Oscar Alejandro Sánchez Lucero via B4 Relay
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08  2:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero

From: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>

Document cvm_oct_sgmii_open() and cvm_oct_sgmii_init() by adding standard
kernel-doc comment blocks. This fixes styling inconsistencies across the
octeon staging subsystem and allows documentation scripts to correctly
parse the function parameters and return values.

Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
 drivers/staging/octeon/ethernet-sgmii.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c
index d7fbd9159302..2cd717709414 100644
--- a/drivers/staging/octeon/ethernet-sgmii.c
+++ b/drivers/staging/octeon/ethernet-sgmii.c
@@ -16,11 +16,23 @@
 #include "ethernet-util.h"
 #include "ethernet-mdio.h"
 
+/**
+ * cvm_oct_sgmii_open - open the SGMII interface
+ * @dev:    Net device to open
+ *
+ * Return: Zero on success
+ */
 int cvm_oct_sgmii_open(struct net_device *dev)
 {
 	return cvm_oct_common_open(dev, cvm_oct_link_poll);
 }
 
+/**
+ * cvm_oct_sgmii_init - initialize the SGMII interface
+ * @dev:    Net device to initialize
+ *
+ * Return: Zero on success
+ */
 int cvm_oct_sgmii_init(struct net_device *dev)
 {
 	cvm_oct_common_init(dev);

-- 
2.56.0



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

* [PATCH 2/4] staging: octeon: fix OF node leak and kernel-doc in ethernet-mdio.c
  2026-11-08  2:07 [PATCH 0/4] Subject: [PATCH v2 0/4] staging: octeon: Clean up PHY interfaces and fix race conditions Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 1/4] staging: octeon: add kernel-doc to ethernet-sgmii.c functions Oscar Alejandro Sánchez Lucero via B4 Relay
@ 2026-11-08  2:07 ` Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 3/4] staging: octeon: fix race condition and log macro in ethernet-rgmii.c Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 4/4] staging: octeon: fix IRQ leak error path and remove dst.h from ethernet-spi.c Oscar Alejandro Sánchez Lucero via B4 Relay
  3 siblings, 0 replies; 5+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08  2:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero

From: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>

Fix a reference count leak in cvm_oct_phy_setup_device() where the
device_node pointer 'phy_node' was not released if of_phy_connect()
returned NULL on a probe deferral scenario. Balance the reference count
by calling of_node_put() within the error path block.

Additionally, correct the documentation style of the function by
replacing 'Returns' with the standard 'Return:' keyword to comply with
kernel-doc scripting requirements.

Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
 drivers/staging/octeon/ethernet-mdio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 211423059e30..05bc536ebded 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -151,11 +151,13 @@ int cvm_oct_phy_setup_device(struct net_device *dev)
 
 	phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
 				priv->phy_mode);
-	of_node_put(phy_node);
 
-	if (!phydev)
+	if (!phydev) {
+		of_node_put(phy_node);
 		return -EPROBE_DEFER;
+	}
 
+	of_node_put(phy_node);
 	priv->last_link = 0;
 	phy_start(phydev);
 

-- 
2.56.0



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

* [PATCH 3/4] staging: octeon: fix race condition and log macro in ethernet-rgmii.c
  2026-11-08  2:07 [PATCH 0/4] Subject: [PATCH v2 0/4] staging: octeon: Clean up PHY interfaces and fix race conditions Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 1/4] staging: octeon: add kernel-doc to ethernet-sgmii.c functions Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 2/4] staging: octeon: fix OF node leak and kernel-doc in ethernet-mdio.c Oscar Alejandro Sánchez Lucero via B4 Relay
@ 2026-11-08  2:07 ` Oscar Alejandro Sánchez Lucero via B4 Relay
  2026-11-08  2:07 ` [PATCH 4/4] staging: octeon: fix IRQ leak error path and remove dst.h from ethernet-spi.c Oscar Alejandro Sánchez Lucero via B4 Relay
  3 siblings, 0 replies; 5+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08  2:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero

From: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>

Fix a race condition in cvm_oct_check_preamble_errors() by moving the
read assignment of priv->link_info inside the global_register_lock
protected critical section. This prevents unsynchronized read-accesses
concurring with status mutations from concurrent polling contexts.

Additionally, modernize the message output by replacing the obsolete
printk_ratelimited() call with netdev_notice_ratelimited().

Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
 drivers/staging/octeon/ethernet-rgmii.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c
index 0c4fac31540a..a9a245b5580a 100644
--- a/drivers/staging/octeon/ethernet-rgmii.c
+++ b/drivers/staging/octeon/ethernet-rgmii.c
@@ -9,8 +9,6 @@
 #include <linux/netdevice.h>
 #include <linux/interrupt.h>
 #include <linux/phy.h>
-#include <linux/ratelimit.h>
-#include <net/dst.h>
 
 #include "octeon-ethernet.h"
 #include "ethernet-defines.h"
@@ -56,14 +54,14 @@ static void cvm_oct_check_preamble_errors(struct net_device *dev)
 	union cvmx_helper_link_info link_info;
 	unsigned long flags;
 
-	link_info.u64 = priv->link_info;
-
 	/*
 	 * Take the global register lock since we are going to
 	 * touch registers that affect more than one port.
 	 */
 	spin_lock_irqsave(&global_register_lock, flags);
 
+	link_info.u64 = priv->link_info;
+
 	if (link_info.s.speed == 10 && priv->last_speed == 10) {
 		/*
 		 * Read the GMXX_RXX_INT_REG[PCTERR] bit and see if we are
@@ -74,7 +72,7 @@ static void cvm_oct_check_preamble_errors(struct net_device *dev)
 		union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
 
 		gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
-							(index, interface));
+		(index, interface));
 		if (gmxx_rxx_int_reg.s.pcterr) {
 			/*
 			 * We are getting preamble errors at 10Mbps. Most
@@ -83,8 +81,8 @@ static void cvm_oct_check_preamble_errors(struct net_device *dev)
 			 * disable preamble checking and do it in software.
 			 */
 			cvm_oct_set_hw_preamble(priv, false);
-			printk_ratelimited("%s: Using 10Mbps with software preamble removal\n",
-					   dev->name);
+			net_notice_ratelimited("%s: Using 10Mbps with software preamble removal\n",
+					       dev->name);
 		}
 	} else {
 		/*

-- 
2.56.0



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

* [PATCH 4/4] staging: octeon: fix IRQ leak error path and remove dst.h from ethernet-spi.c
  2026-11-08  2:07 [PATCH 0/4] Subject: [PATCH v2 0/4] staging: octeon: Clean up PHY interfaces and fix race conditions Oscar Alejandro Sánchez Lucero via B4 Relay
                   ` (2 preceding siblings ...)
  2026-11-08  2:07 ` [PATCH 3/4] staging: octeon: fix race condition and log macro in ethernet-rgmii.c Oscar Alejandro Sánchez Lucero via B4 Relay
@ 2026-11-08  2:07 ` Oscar Alejandro Sánchez Lucero via B4 Relay
  3 siblings, 0 replies; 5+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08  2:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero

From: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>

Fix a resource leak in cvm_oct_spi_init() by properly validating the
return value of cvm_oct_common_init(). If the common initialization
fails, perform a rollback by decrementing the spi port counter and
releasing the shared RML interrupt handler via free_irq().

Additionally, clean up the file header by removing the unused inclusion
of <net/dst.h>.

Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
 drivers/staging/octeon/ethernet-spi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c
index 699c98c5ec13..e6ebc879ccad 100644
--- a/drivers/staging/octeon/ethernet-spi.c
+++ b/drivers/staging/octeon/ethernet-spi.c
@@ -8,7 +8,6 @@
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/interrupt.h>
-#include <net/dst.h>
 
 #include "octeon-ethernet.h"
 #include "ethernet-defines.h"
@@ -206,7 +205,14 @@ int cvm_oct_spi_init(struct net_device *dev)
 		cvm_oct_spi_enable_error_reporting(INTERFACE(priv->port));
 		priv->poll = cvm_oct_spi_poll;
 	}
-	cvm_oct_common_init(dev);
+	r = cvm_oct_common_init(dev);
+	if (r) {
+		number_spi_ports--;
+		if (number_spi_ports == 0)
+			free_irq(OCTEON_IRQ_RML, &number_spi_ports);
+		return r;
+	}
+
 	return 0;
 }
 

-- 
2.56.0



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

end of thread, other threads:[~2026-11-08  2:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08  2:07 [PATCH 0/4] Subject: [PATCH v2 0/4] staging: octeon: Clean up PHY interfaces and fix race conditions Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08  2:07 ` [PATCH 1/4] staging: octeon: add kernel-doc to ethernet-sgmii.c functions Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08  2:07 ` [PATCH 2/4] staging: octeon: fix OF node leak and kernel-doc in ethernet-mdio.c Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08  2:07 ` [PATCH 3/4] staging: octeon: fix race condition and log macro in ethernet-rgmii.c Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08  2:07 ` [PATCH 4/4] staging: octeon: fix IRQ leak error path and remove dst.h from ethernet-spi.c Oscar Alejandro Sánchez Lucero via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®