mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Oscar Alejandro Sánchez Lucero via B4 Relay" <devnull+aleszlucero.gmail.com@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Oscar Alejandro Sánchez Lucero" <aleszlucero@gmail.com>
Subject: [PATCH 4/4] staging: octeon: fix IRQ leak error path and remove dst.h from ethernet-spi.c
Date: Sat, 07 Nov 2026 20:07:58 -0600	[thread overview]
Message-ID: <20261107-octeon-phy-series-v2-v1-4-d7ab0b4b3f17@gmail.com> (raw)
In-Reply-To: <20261107-octeon-phy-series-v2-v1-0-d7ab0b4b3f17@gmail.com>

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



      parent reply	other threads:[~2026-11-08  2:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Oscar Alejandro Sánchez Lucero via B4 Relay [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261107-octeon-phy-series-v2-v1-4-d7ab0b4b3f17@gmail.com \
    --to=devnull+aleszlucero.gmail.com@kernel.org \
    --cc=aleszlucero@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®