From: Jacob Keller <jacob.e.keller@intel.com>
To: Shannon Nelson <shannon.nelson@amd.com>, <netdev@vger.kernel.org>,
<davem@davemloft.net>, <kuba@kernel.org>, <edumazet@google.com>,
<pabeni@redhat.com>, <andrew+netdev@lunn.ch>
Cc: <brett.creeley@amd.com>
Subject: Re: [PATCH net 1/3] ionic: Fix netdev notifier unregister on failure
Date: Tue, 10 Dec 2024 12:59:31 -0800 [thread overview]
Message-ID: <564b9d98-4d64-40ab-a523-4487712430dd@intel.com> (raw)
In-Reply-To: <20241210174828.69525-2-shannon.nelson@amd.com>
On 12/10/2024 9:48 AM, Shannon Nelson wrote:
> From: Brett Creeley <brett.creeley@amd.com>
>
> If register_netdev() fails, then the driver leaks the netdev notifier.
> Fix this by calling ionic_lif_unregister() on register_netdev()
> failure. This will also call ionic_lif_unregister_phc() if it has
> already been registered.
>
> While at it, remove the empty and unused nb_work and associated
> ionic_lif_notify_work() function.
>
> Fixes: 30b87ab4c0b3 ("ionic: remove lif list concept")
> Signed-off-by: Brett Creeley <brett.creeley@amd.com>
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
I'm not certain about the inclusion of cleanup to drop unused code in
the same commit as an obvious fix. However, the changes as a whole seem
ok to me:
With or without splitting:
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> drivers/net/ethernet/pensando/ionic/ionic.h | 1 -
> drivers/net/ethernet/pensando/ionic/ionic_lif.c | 11 ++---------
> 2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
> index 1c61390677f7..faaf96af506d 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic.h
> +++ b/drivers/net/ethernet/pensando/ionic/ionic.h
> @@ -59,7 +59,6 @@ struct ionic {
> DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX);
> cpumask_var_t *affinity_masks;
> struct delayed_work doorbell_check_dwork;
> - struct work_struct nb_work;
> struct notifier_block nb;
> struct rw_semaphore vf_op_lock; /* lock for VF operations */
> struct ionic_vf *vfs;
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 40496587b2b3..bfa24c659d84 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -3804,10 +3804,6 @@ int ionic_lif_init(struct ionic_lif *lif)
> return err;
> }
>
> -static void ionic_lif_notify_work(struct work_struct *ws)
> -{
> -}
> -
> static void ionic_lif_set_netdev_info(struct ionic_lif *lif)
> {
> struct ionic_admin_ctx ctx = {
> @@ -3858,8 +3854,6 @@ int ionic_lif_register(struct ionic_lif *lif)
>
> ionic_lif_register_phc(lif);
>
> - INIT_WORK(&lif->ionic->nb_work, ionic_lif_notify_work);
> -
> lif->ionic->nb.notifier_call = ionic_lif_notify;
>
> err = register_netdevice_notifier(&lif->ionic->nb);
> @@ -3869,8 +3863,8 @@ int ionic_lif_register(struct ionic_lif *lif)
> /* only register LIF0 for now */
> err = register_netdev(lif->netdev);
> if (err) {
> - dev_err(lif->ionic->dev, "Cannot register net device, aborting\n");
> - ionic_lif_unregister_phc(lif);
> + dev_err(lif->ionic->dev, "Cannot register net device: %d, aborting\n", err);
> + ionic_lif_unregister(lif);
> return err;
> }
>
> @@ -3885,7 +3879,6 @@ void ionic_lif_unregister(struct ionic_lif *lif)
> {
> if (lif->ionic->nb.notifier_call) {
> unregister_netdevice_notifier(&lif->ionic->nb);
> - cancel_work_sync(&lif->ionic->nb_work);
> lif->ionic->nb.notifier_call = NULL;
> }
>
next prev parent reply other threads:[~2024-12-10 21:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 17:48 [PATCH net 0/3] ionic: minor code fixes Shannon Nelson
2024-12-10 17:48 ` [PATCH net 1/3] ionic: Fix netdev notifier unregister on failure Shannon Nelson
2024-12-10 20:59 ` Jacob Keller [this message]
2024-12-12 4:28 ` Jakub Kicinski
2024-12-12 17:47 ` Nelson, Shannon
2024-12-10 17:48 ` [PATCH net 2/3] ionic: no double destroy workqueue Shannon Nelson
2024-12-10 21:02 ` Jacob Keller
2024-12-10 21:44 ` Nelson, Shannon
2024-12-11 19:23 ` Jacob Keller
2024-12-10 17:48 ` [PATCH net 3/3] ionic: use ee->offset when returning sprom data Shannon Nelson
2024-12-10 21:03 ` Jacob Keller
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=564b9d98-4d64-40ab-a523-4487712430dd@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shannon.nelson@amd.com \
/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.