All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Prashant Rahul <prashantrahul23@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Shuah Khan <shuah@kernel.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] staging: octeon: factor out device removal into a helper
Date: Mon, 29 Jun 2026 10:25:21 +0300	[thread overview]
Message-ID: <akId4dR-VjQqu5d_@stanley.mountain> (raw)
In-Reply-To: <20260628-staging-driver-octeon-panic-v1-1-fe8c34989254@gmail.com>

On Sun, Jun 28, 2026 at 12:31:24PM +0530, Prashant Rahul wrote:
> Factor out the common device removal sequence into a helper in
> preparation for adding cleanup to the probe error path.
> 
> Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
> ---
>  drivers/staging/octeon/ethernet.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> index f3fa221f452e2..e07c6911b8252 100644
> --- a/drivers/staging/octeon/ethernet.c
> +++ b/drivers/staging/octeon/ethernet.c
> @@ -104,6 +104,21 @@ struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
>  
>  u64 cvm_oct_tx_poll_interval;
>  
> +static inline void cvm_oct_remove_device(int port)
> +{
> +	if (cvm_oct_device[port]) {
> +		struct net_device *dev = cvm_oct_device[port];
> +		struct octeon_ethernet *priv = netdev_priv(dev);
> +
> +		cancel_delayed_work_sync(&priv->port_periodic_work);
> +
> +		cvm_oct_tx_shutdown_dev(dev);
> +		unregister_netdev(dev);
> +		free_netdev(dev);
> +		cvm_oct_device[port] = NULL;
> +	}
> +}
> +
>  static void cvm_oct_rx_refill_worker(struct work_struct *work)
>  {
>  	struct octeon_ethernet_platform *plat = container_of(work,
> @@ -949,17 +964,7 @@ static void cvm_oct_remove(struct platform_device *pdev)
>  
>  	/* Free the ethernet devices */
>  	for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
> -		if (cvm_oct_device[port]) {
> -			struct net_device *dev = cvm_oct_device[port];
> -			struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -			cancel_delayed_work_sync(&priv->port_periodic_work);
> -
> -			cvm_oct_tx_shutdown_dev(dev);
> -			unregister_netdev(dev);
> -			free_netdev(dev);
> -			cvm_oct_device[port] = NULL;
> -		}
> +		cvm_oct_remove_device(port);
>  	}

Delete the curly braces as well.

regards,
dan carpenter


  reply	other threads:[~2026-06-29  7:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-28  7:01 [PATCH 0/4] staging: octeon: Improve initialization error handling Prashant Rahul
2026-06-28  7:01 ` [PATCH 1/4] staging: octeon: factor out device removal into a helper Prashant Rahul
2026-06-29  7:25   ` Dan Carpenter [this message]
2026-06-29  7:45   ` Dan Carpenter
2026-06-28  7:01 ` [PATCH 2/4] staging: octeon: Propagate rx initialization failures Prashant Rahul
2026-06-28  7:01 ` [PATCH 3/4] staging: octeon: Propagate tx " Prashant Rahul
2026-06-28  7:01 ` [PATCH 4/4] staging: octeon: handle rx/tx initialization failures in probe Prashant Rahul
2026-06-29  7:44   ` Dan Carpenter
2026-06-29  7:24 ` [PATCH 0/4] staging: octeon: Improve initialization error handling Dan Carpenter
2026-06-29  8:25   ` Prashant Rahul
2026-06-29  8:45     ` Dan Carpenter

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=akId4dR-VjQqu5d_@stanley.mountain \
    --to=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=prashantrahul23@gmail.com \
    --cc=shuah@kernel.org \
    /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 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.