From: Paul Greenwalt <paul.greenwalt@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: Paul Greenwalt <paul.greenwalt@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Subject: [PATCH iwl-next v2 1/4] idpf: clear drvdata in idpf_decfg_device()
Date: Thu, 3 Sep 2026 04:27:39 -0400 [thread overview]
Message-ID: <20260903082742.43837-2-paul.greenwalt@intel.com> (raw)
In-Reply-To: <20260903082742.43837-1-paul.greenwalt@intel.com>
pci_set_drvdata(pdev, adapter) is set as the last step of
idpf_cfg_device(), but its declared inverse, idpf_decfg_device(),
does not clear it. idpf_remove() open-codes the clear right after
calling idpf_decfg_device(), so the two functions are not true
opposites of each other.
Move the pci_set_drvdata(pdev, NULL) into idpf_decfg_device() so the
set/clear pairing lives in one place, and drop the now-redundant
explicit clear from idpf_remove(). idpf_decfg_device() is also called
from idpf_probe()'s err_init_wq unwind path, which did not previously
clear drvdata at all; it now does too, closing that window for
consistency with the rest of the teardown path. This has no
observable effect: the driver core already clears drvdata via
dev_set_drvdata() when a probe function returns an error, under
device_lock(), before any consumer of drvdata can observe a stale
pointer.
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
index 1e4dd9b713a0..fc67d8f02569 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_main.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
@@ -112,6 +112,9 @@ static void idpf_decfg_device(struct idpf_adapter *adapter)
pci_disable_ptm(pdev);
libie_pci_unmap_all_mmio_regions(&adapter->ctlq_ctx.mmio_info);
+
+ /* pairs with pci_set_drvdata() in idpf_cfg_device() */
+ pci_set_drvdata(pdev, NULL);
}
/**
@@ -182,7 +185,6 @@ static void idpf_remove(struct pci_dev *pdev)
mutex_destroy(&adapter->vc_buf_lock);
idpf_decfg_device(adapter);
- pci_set_drvdata(pdev, NULL);
kfree(adapter);
}
--
2.52.0
next prev parent reply other threads:[~2026-09-03 16:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 8:27 [PATCH iwl-next v2 0/4] idpf: add devlink info support with selftest Paul Greenwalt
2026-09-03 8:27 ` Paul Greenwalt [this message]
2026-09-03 8:27 ` [PATCH iwl-next v2 2/4] idpf: add devlink support Paul Greenwalt
2026-09-03 8:27 ` [PATCH iwl-next v2 3/4] idpf: add devlink info support Paul Greenwalt
2026-09-03 8:27 ` [PATCH iwl-next v2 4/4] selftests: net: hw: add devlink info test Paul Greenwalt
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=20260903082742.43837-2-paul.greenwalt@intel.com \
--to=paul.greenwalt@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=przemyslaw.kitszel@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox